<?php
/* *
 * $Author ：PHPYUN开发团队
 *
 * 官网: http://www.phpyun.com
 *
 * 版权所有 2009-2018 宿迁鑫潮信息技术有限公司，并保留所有权利。
 *
 * 软件声明：未经授权前提下，不得用于商业运营、二次开发以及任何形式的再次发布。
 */
class com_controller extends wap_controller{
	
	function get_user(){
		$rows=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		if(!$rows['name'] || !$rows['address'] || !$rows['pr']){
		// if(!$rows['name'] || !$rows['address']){
			$data['msg']='请先完善企业资料！';
			$data['url']='index.php?c=info';
			$this->yunset("layer",$data);
		}
		if(!$rows['logo'] || $rows['logo_status']!='0' ||!file_exists(str_replace('./',APP_PATH,$rows['logo']))){
			$rows['logo']=$this->config['sy_weburl']."/".$this->config['sy_unit_icon'];
		}else{
			$rows['logo']=str_replace("./",$this->config['sy_weburl']."/",$rows['logo']);
		}
		$this->yunset("company",$rows);
		return $rows;
	}
	
	function waptpl($tpname){
		$this->yuntpl(array('wap/member/com/'.$tpname));
	}

	function index_action(){

		$this->rightinfo();
		$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."'","`login_date`,`status`,`head_img`,`realname_jam`,`hy`");
		$this->yunset("member",$member);
		
		$date=date("Ymd"); 
		$reg=$this->obj->DB_select_once("member_reg","`uid`='".$this->uid."' and `usertype`='".$this->usertype."' and `date`='".$date."'"); 
		if($reg['id']){
			$signstate=1;
		}else{
			$signstate=0;
		}
		$this->yunset("signstate",$signstate);
		
		$jobs=$this->obj->DB_select_all("company_job","`state`=1 and `r_status`<>2 and `status`<>1 and `uid`='".$this->uid."'");
		if($jobs && is_array($jobs)){
			foreach($jobs as $key=>$v){
				$ids[]=$v['id'];
			}
			$jobids ="".@implode(",",$ids)."";
			$this->yunset("jobids",$jobids);
		}	
		/*jam添加获取待审核的员工认证s*/	
		$rz_num=$this->obj->DB_select_once("company_user"," `companyid`='".$this->uid."' and `status`=1 "," count(`id`) as `num`");
		$this->yunset('rz_num',$rz_num['num']);
		/*jam添加获取待审核的员工认证e*/	
		$this->yunset('headertitle',"我的");
		$statis = $this->company_satic();
		$this->yunset("statis",$statis);


		/*jam不合适*/
		$no_ok=$this->obj->DB_select_num('userid_job'," (`is_browse`=4 and `com_id`='".$this->uid."' ) OR ( `is_browse`=7  and `com_id`='".$this->uid."') ","id");

		/*jam已报名*/
		$SQL = "SELECT count(*) as num FROM phpyun_userid_job WHERE com_id = '".$this->uid."' and ". "  job_id NOT IN (SELECT jobid FROM phpyun_userid_msg)";
		$query=$this->db->query($SQL);
		while($row=$this->db->fetch_array($query)){$returns=$row['num'];}
		$this->yunset('no_ok',$no_ok);
		$this->yunset('bm',$returns);
				
		$lalala=$this->obj->DB_select_all("userid_msg"," `fid`='".$this->uid."' order by id desc");
		if(is_array($lalala) && !empty($lalala)){
			$dqr = array();
			$dones = array();
				foreach($lalala as $k=>$v){
					/*投递简历记录表的中的id*/
					$tj = $this->obj->DB_select_once("userid_job","`uid`='".$v['uid']."' and `job_id`='".$v['jobid']."'" ,"`id`,`is_browse`");
					// print_r($tj);
					if($tj['is_browse'] >= 6 && $tj['is_browse']!=7){
						$dones[] = $v;
					}
				
					if($tj['is_browse'] <5){
						$dqr[] = $v;
					}
				}
		}
	
		$this->yunset('dones',count($dones));
		$this->yunset('dqr',count($dqr));



		$this->cookie->SetCookie("updatetoast",'1',time() + 86400);
		$this->get_user();
		$this->yunset('backurl',Url('wap',array()));
		
 		$this->waptpl('index');
	}
	function com_action(){
		
		$this->rightinfo();
		$this->company_satic();
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		if($statis['rating']){
			$rating=$this->obj->DB_select_once("company_rating","`id`='".$statis['rating']."'");
		}
		$com=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		if($statis['rating']>0){
			if($statis['vip_etime']>time()){
				$days=round(($statis['vip_etime']-mktime())/3600/24) ;
				$this->yunset("days",$days);
			}
		}
		$allprice=$this->obj->DB_select_once("company_pay","`com_id`='".$this->uid."' and `type`='1' and `order_price`<0","sum(order_price) as allprice");
		if($allprice['allprice']==''){$allprice['allprice']='0';}
		$this->yunset("integral",number_format(str_replace("-","", $allprice['allprice'])));
		$this->yunset("com",$com);
		$this->yunset("statis",$statis);
		$this->yunset("rating",$rating);
		$backurl=Url('wap',array('c'=>'finance'),'member');
		$this->yunset('backurl',$backurl);
		
		$this->yunset('header_title',"我的服务");
		$this->get_user();
		$this->waptpl('com');
	}
    function map_action(){
        if($_POST['submit']){
            if($_POST['xvalue']==""){
                $data['msg']='请设置企业地图！';
            }else{
                $IntegralM=$this->MODEL('integral');
                $rows = $this->obj->DB_select_once("company","`uid`='".$this->uid."'","`x`,`y`");
                if($rows['x'] == "" && $rows['y'] == ""){
                    $IntegralM->get_integral_action($this->uid,"integral_map","设置企业地图");
                }
                $data['x']=(float)$_POST['xvalue'];
                $data['y']=(float)$_POST['yvalue'];
                $nid=$this->obj->update_once("company",$data,array("uid"=>$this->uid));
                if($nid){
					$this->obj->DB_update_all("company_job","`x`='".$data['x']."',`y`='".$data['y']."'","`uid`='".$this->uid."'");
                    $this->obj->member_log("设置企业地图",15,1);
                    $data['msg']='地图设置成功！';
                    $data['url']="index.php?c=set";
                }else{
					$data['msg']='地图设置失败！';
                    $data['url']=$_SERVER['HTTP_REFERER'];
                }
            }
           
            
        }
        $this->yunset("layer",$data);
        $urlarr=array("c"=>"map","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
        $row=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","x,y,address,provinceid,cityid,three_cityid");
		$this->yunset("row",$row);
		$this->yunset($this->MODEL('cache')->GetCache(array('city')));
		
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		
		$this->yunset('header_title',"设置地图");
		
		$this->get_user();
        $this->waptpl('map');
    }
     function reportlist_action(){
        
        if($_POST['submit']){
            if($_POST['reason']==""){
                $data['msg']='请选择举报原因！';
            }else{
                $data['c_uid']=(int)$_GET['uid'];
                $data['inputtime']=mktime();
                $data['p_uid']=$this->uid;
                $data['did']=$this->userid;
                $data['usertype']=(int)$this->usertype;
                $data['eid']=(int)$_GET['eid'];
                $data['r_name']=$_GET['r_name'];
                $data['username']=$this->username;
                $data['r_reason']=@implode(',',$_POST['reason']);
                $nid=$this->obj->insert_into("report",$data);
                if($nid){
                    $this->obj->member_log("举报简历",23,1);
                    $data['msg']='举报成功！';
                    $data['url']='index.php?c=down';
                }else{
                    $data['msg']='举报失败！';
                    $data['url']='index.php?c=down';
                }
            }
            
            
        }
        $this->yunset("layer",$data);
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"举报简历");
		$this->get_user();
		$this->waptpl('reportlist');
	}
	function info_action(){
		$this->rightinfo();
		if($_POST['submit']){
			$this->cookie->SetCookie("delay", "", time() - 60);
			$_POST=$this->post_trim($_POST);
			$comname=$this->obj->DB_select_num('company',"`uid`<>'".$this->uid."' and `name`='".$_POST['name']."'","`uid`");
			 
			if($data['msg']==''){
 				if($_POST['name']==""){
					$data['msg']='企业全称不能为空！';
				}elseif($comname>1){
					$data['msg']='企业全称已存在！';
				}elseif($_POST['hy']==""){
					$data['msg']='从事行业不能为空！';
				}elseif($_POST['pr']==""){
					$data['msg']='企业性质不能为空！';
				}elseif($_POST['provinceid']==""){
					$data['msg']='所在地不能为空！';
				}elseif($_POST['mun']==""){
					$data['msg']='企业规模不能为空！';
				}else if($_POST['address']==""){
					$data['msg']='公司地址不能为空！';
				}
				// else if($_POST['linkphone']==""&&$_POST['linktel']==""){
				// 	$data['msg']='手机或电话必填一项！';
				// }
				elseif($_POST['content']==""){
					$data['msg']='企业简介不能为空！';
				}
			}
			if($data['msg']==''){

				delfiledir("../data/upload/tel/".$this->uid);
				$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
				$Member=$this->MODEL("userinfo");
				// if($company['moblie_status']==1){
				// 	unset($_POST['linktel']);
				// }elseif($_POST['linktel']){
				// 	// $moblieNum = $Member->GetMemberNum(array("moblie"=>$_POST['linktel'],"`uid`<>'".$this->uid."'"));

				// 	// if(!CheckMoblie($_POST['linktel'])){
				// 	// 	$data['msg']='手机号码格式错误！';
				// 	// }elseif($moblieNum>0){
				// 	// 	$data['msg']='手机号码已存在！';
				// 	// }else{
				// 	// 	$mvalue['moblie']=$_POST['linktel'];
				// 	// }

				// }
				if($company['email_status']==1){
					unset($_POST['linkmail']);
				}elseif($_POST['linkmail']){
					
					$emailNum = $Member->GetMemberNum(array("email"=>$_POST['linkmail'],"`uid`<>'".$this->uid."'"));
					if(CheckRegEmail($_POST['linkmail'])==false){
						$data['msg']='联系邮箱格式错误！';
					}elseif($emailNum>0){
						$data['msg']='联系邮箱已存在！';
					}else{
						$mvalue['email']=$_POST['linkmail'];
					}
				}
				
				if($company['yyzz_status']=='1'){
					$_POST['name'] = $company['name'];
				}
			
				
				if(is_uploaded_file($_FILES['comqcode']['tmp_name'])){
					
				
 				    $UploadM=$this->MODEL('upload');
				    $upload=$UploadM->Upload_pic(APP_PATH."/data/upload/company/",false);
				    
				    $pictures=$upload->picture($_FILES['comqcode']);
				    
				    $pic=str_replace(APP_PATH."/data/upload/company/","./data/upload/company/",$pictures);
				    $_POST['comqcode']=$pic;
				}
				
				if($_POST['preview']){
						
				
					$UploadM =$this->MODEL('upload');
					$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/company/",false);
					$pic     =$upload->imageBase($_POST['preview']);
					$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);
					if($picmsg['status']==$pic){
						$data['msg']=$picmsg['msg'];
	 				}else{
						$_POST['comqcode']=str_replace(APP_PATH."/data/upload/company/","./data/upload/company/",$pic);
						if($company['comqcode']){
							unlink_pic(APP_PATH.$company['comqcode']);
						}
					}
				} 
				

				
				unset($_POST['submit']);
				$where['uid']=$this->uid;
				$_POST['lastupdate']=time();
				$_POST['welfare']=@explode(',',$_POST['welfare']);
				foreach($_POST['welfare'] as $v){
					if($v){
						$welfare[]=$v;
					}
				}
				$_POST['welfare']=@implode(',',$welfare);

				if($data['msg']==""){

					$nid=$this->obj->update_once("company",$_POST,$where);
					if($nid){
						if(!empty($mvalue)){
							$this->obj->update_once('member',$mvalue,array("uid"=>$this->uid));
						}
						$data['com_name']=$_POST['name'];
						$data['pr']=$_POST['pr'];
						$data['mun']=$_POST['mun'];
						$data['com_provinceid']=$_POST['provinceid'];
						$data['welfare']=@implode(',',$_POST['welfare']);
						$data['com_logo']=$_POST['photo'];
						$this->obj->update_once("company_job",$data,array("uid"=>$this->uid));
						if($company['name']!=$_POST['name']){
							$this->obj->update_once("partjob",array("com_name"=>$_POST['name']),array("uid"=>$this->uid));
							$this->obj->update_once("userid_job",array("com_name"=>$_POST['name']),array("com_id"=>$this->uid));
							$this->obj->update_once("fav_job",array("com_name"=>$_POST['name']),array("com_id"=>$this->uid));
							$this->obj->update_once("report",array("r_name"=>$_POST['name']),array("c_uid"=>$this->uid));
							$this->obj->update_once("blacklist",array("com_name"=>$_POST['name']),array("c_uid"=>$this->uid));
							$this->obj->update_once("msg",array("com_name"=>$_POST['name']),array("job_uid"=>$this->uid));
						}

						if($company['lastupdate']<1){
							if($this->config['integral_userinfo_type']=="1"){
								$auto=true;
							}else{
								$auto=false;
							}
							$this->sendredpack(array('type'=>'4','uid'=>$this->uid));

							$this->MODEL('integral')->company_invtal($this->uid,$this->config['integral_userinfo'],$auto,"首次填写基本资料",true,2,'integral',25);
						}
						$this->obj->member_log("修改企业资料",7,1);
						$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$_POST['logid']."'");
						$data['msg']='更新成功！';
						$data['url']='index.php';
					}else{
						$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$_POST['logid']."'");
 						$data['msg']='更新失败！';
						$data['url']='index.php?c=info';
					}
				}else{
						
					$data['msg']=$data['msg'];
				}				
				
			}
			echo json_encode($data);die;
		}
		$row=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		if ($row['comqcode']){
			$row['comqcode']=str_replace('./', $this->config['sy_weburl'].'/', $row['comqcode']);
		}
		if ($row['logo']){
			$row['logo']=str_replace('./', $this->config['sy_weburl'].'/', $row['logo']);
		}
		 
		if ($row['welfare']){
			$row['arraywelfare']=explode(',', $row['welfare']);
		}
		
		if ($row['content']){
			$row['content_t']=strip_tags($row['content']);
		}
 
		$this->yunset($this->MODEL('cache')->GetCache(array('city','com','hy')));
		$this->yunset("row",$row);
		
		$this->yunset('header_title',"企业基本信息");
		$this->waptpl('info');
	}
	
	function get_com($type){
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		
		if($statis['rating_type'] && $statis['rating']) {

			if($type==1){
				if($statis['rating_type']=='1' && $statis['job_num']>0 && ($statis['vip_etime']<1 || $statis['vip_etime']>=time())){
					$value="`job_num`=`job_num`-1";
				}elseif($statis['rating_type']=='2' && ($statis['vip_etime']>time() || $statis['vip_etime']=='0')){
					$value=null;
				}else{
					return "你的套餐不够发布职位！";
				}
			}elseif($type==4){
				if($statis['rating_type']=='2' && ($statis['vip_etime']>time() || $statis['vip_etime']=='0')){
					$value=null;
				}else{
					return "你的套餐不够发布职位！";
				}
			}elseif($type==7){
				if($statis['rating_type']=='1' && $statis['part_num']>0 && ($statis['vip_etime']<1 || $statis['vip_etime']>=time())){
					$value="`part_num`=`part_num`-1";
				}elseif($statis['rating_type']=='2' && ($statis['vip_etime']>time() || $statis['vip_etime']=='0')){
					$value=null;
				}else{
					return "你的套餐不够发布兼职！";
				}
			}
			if($value){
				$this->obj->DB_update_all("company_statis",$value,"`uid`='".$this->uid."'");
			}
		}else{
			return "你的会员已经到期！";
		}
	}
	 
	function jobadd6_action(){

		include(CONFIG_PATH."db.data.php");
		$this->yunset("arr_data",$arr_data);
		$this->get_user();
		$statics=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'"); 
		$job_pay = floor($statics['job_pay']);
		$row=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");

		if($row['lastupdate']<1){
			$data['msg']="请先完善基本资料！";
			$data['url']='index.php?c=info';
		}
		$this->rightinfo();
		$msg=array();
		$isallow_addjob="1";
		
		if($this->config['com_enforce_emailcert']=="1"){
		    if($row['email_status']!="1"){
				$isallow_addjob="0";
				$msg[]="邮箱认证";
				$data['url']='index.php?c=set';
			}
		}
		if($this->config['com_enforce_mobilecert']=="1"){
		    if($row['moblie_status']!="1"){
		    	$isallow_addjob="0";
				$msg[]="手机认证";
				$data['url']='index.php?c=set';
			}
		}

		if($this->config['com_enforce_licensecert']=="1"){
			
		    if($row['yyzz_status']!="1"){
		    	$isallow_addjob="0";
				$msg[]="营业执照认证";
				$data['url']='index.php?c=comcert';
			}
		}
		if($this->config['com_enforce_setposition']=="1"){
		    if(empty($row['x'])||empty($row['y'])){
				$isallow_addjob="0";
				$msg[]="企业地图设置";
				$data['url']="index.php?c=map";
			}
		}
		
		if($isallow_addjob=="0"){
			
			$data['msg']="请先完成".implode(",",$msg)."！";
			
		}else if($_GET['id']){
			$job=$this->obj->DB_select_once("company_job","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'");
			$arr_data1=$arr_data['sex'][$job['sex']];
			$this->yunset("arr_data1",$arr_data1);
			if($job['id']){
				$job['langid']=$job['lang'];
				if($job['lang']!=""){
					$job['lang']= @explode(",",$job['lang']);
				}
				//whp 新增职位标签 字段 s 0318
				$job['labelid']=$job['label'];
				if($job['label']!=""){
					$job['label']= @explode(",",$job['label']);
				}
				//whp 新增职位标签 字段 e 0318
				$job['days']= ceil(($job['edate']-$job['sdate'])/86400);
				$job_link=$this->obj->DB_select_once("company_job_link","`jobid`='".(int)$_GET['id']."' and `uid`='".$this->uid."'");
				$this->yunset("job_link",$job_link);
				$job['islink']=$job_link['link_type'];
 				$job['isemail']=$job_link['email_type'];
 				if($job['description']){
 					$job['description_t']=strip_tags($job['description']);
 				}
				$this->yunset("row",$job);
			}else{
				$data['msg']='非法操作！';
				$data['url']='index.php?c=job';
			}
		}
		if($_POST['submit']){
		
			//whp 新增赏金验证
			$job_money = $_POST['job_pay'];
			if($job_money > $job_pay){
				$data['msg']="你的赏金不足,请充值后继续发布";
				$data['url']='index.php?c=jobadd6';
			}
			
			
  			$id=intval($_POST['id']);
			$state= intval($_POST['state']);
			$logid = $_POST['logid'];

			unset($_POST['submit']);
			unset($_POST['id']);
			unset($_POST['state']);
			unset($_POST['logid']);

			$companycert=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."'and type=3","uid,type,status");
			if($this->config['com_free_status']=="1"&&$companycert['status']=="1"){	
				$_POST['state']=1;
			}else{
				$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."'","`status`,`did`");
				if($member['status']!="1"){
					$_POST['state']=0;
				}else{
					$_POST['state']=$this->config['com_job_status'];
				}
			}
			$_POST['r_status']=1;
			if(!empty($_POST['lang'])){
				$_POST['lang'] = pylode(",",$_POST['lang']);
			}else{
				$_POST['lang'] = "";
			}
			//whp 新增职位标签 字段 s 0318

		
			if(!empty($_POST['label'])){
				$_POST['label'] = pylode(",",$_POST['label']);
			}else{
				$_POST['label'] = "";
			}

			//whp 新增职位标签 字段 e 0318
			$_POST['sdate']=time();
 			
			$mapinfo=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`x`,`y`,`apply_pro`,`direct_pro`,`share_pro`");
			if($mapinfo){
				$_POST['x']=$mapinfo['x'];
 				$_POST['y']=$mapinfo['y'];
			}
			$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'","`rating`");
			$_POST['com_name']=$row['name'];
			$_POST['com_logo']=$row['logo'];
			$_POST['com_provinceid']=$row['provinceid'];
			$_POST['pr']=$row['pr'];
			$_POST['mun']=$row['mun'];
			$_POST['rating']=$statis['rating'];
			$islink=(int)$_POST['islink'];
			$tblink=$_POST['tblink'];
			$link_type=$islink;
			if($islink<3){
				$linktype=$islink;
				$islink=1;
			}else{
				$islink=0;
			}
			$isemail=(int)$_POST['isemail'];
			$emailtype=$isemail;
			if($isemail<3){
				$isemail=1;
			}else{
				$isemail=0;
			}
			if($_POST['salary_type']==1){
				$_POST['minsalary']=$_POST['maxsalary']=0;
			}
			$_POST['is_link']=$islink;
			$_POST['link_type']=$linktype;
 			$_POST['is_email']=$isemail;
			$link_moblie=$_POST['link_moblie'];
			$email=$_POST['email'];
			$link_man=$_POST['link_man'];
			unset($_POST['salary_type']);
			unset($_POST['link_moblie']);
			unset($_POST['islink']);
			unset($_POST['isemail']);
			unset($_POST['link_man']);
			unset($_POST['email']);
			if($this->config['com_job_status']=="0" && $_POST['state']!=1){
			    $msg=",请等待审核";
			}else{
				$msg="";
			}

			if(!$id){
				$_POST['lastupdate']=time();
				$_POST['uid']=$this->uid;
				$_POST['did']=$member['did'];

				// $data['msg']=$this->get_com(1);/*jam去电会员过期验证*/
				// if($data['msg']==''){
					$_POST['source']=2;
					/*jam添加三种比例值*/
					$zpdivide = array($mapinfo['apply_pro'], $mapinfo['direct_pro'], $mapinfo['share_pro']);

					$_POST['zpdivide'] = serialize($zpdivide);;
					$nid=$this->obj->insert_into("company_job",$_POST);
					$name="添加职位";
					if($nid){

							/*jam多图上传处理s*/
							$nums  =count($_FILES);
							$UploadM = $this->MODEL('upload');
							$upload=$UploadM->Upload_pic("../../data/upload/job/",false);
							for ($i=0; $i < $nums; $i++) { 
								$pic=$upload->picture($_FILES['imgs'.$i]);
								$picmsg=$UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);
								if($picmsg){
									$imgid=$this->obj->insert_into("company_job_img",array('jobid'=>$nid,'imgurl'=>$picmsg,'addtime'=>time()));
								}
							}
							/*jam多图上传处理e*/

						$job_pay_money = number_format($job_money,2);
						if($job_pay_money >0){
							//whp 发布后扣钱
							$status=$this->obj->DB_update_all("company_statis","`job_pay`= `job_pay`-'".$job_pay_money."'","`uid`='".$this->uid."'");

							$pay['order_price']='-'.$job_money;
							$pay['order_id']=time().rand(10000,99999);
							$pay['pay_time']=time();
							$pay['pay_state']='2';
							$pay['com_id']=$this->uid;
							$pay['pay_remark']='发布职位消费赏金';
							$pay['type']='226';
							$pay['pay_type']='2';
							$pay['did']=$nid;
							$this->obj->insert_into("company_pay_order",$pay);

						}
						
						$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$logid."'");
						$this->obj->DB_update_all("company","`jobtime`='".$_POST['lastupdate']."'","`uid`='".$this->uid."'");
						$state_content = "发布了新职位 <a href=\"".Url("job",array("c"=>"comapply","id"=>$nid))."\" target=\"_blank\">".$_POST['name']."</a>。";
						$this->addstate($state_content);
						$this->obj->member_log("发布了新职位 ".$_POST['name'],1,1);
						$Warning=$this->MODEL("warning");
						$Warning->warning("1");
					}else{
						$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$logid."'");
					}
					$data['msg']=$nid?$name."成功".$msg:$name."失败";
				// }
			}else{
				

				$where['id']=$id;
				$where['uid']=$this->uid;
				
				$nid=$this->obj->update_once("company_job",$_POST,$where);
				$name="更新职位";
				if($nid){
					$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$logid."'");
					$this->obj->member_log("更新职位《".$_POST['name']."》",1,2);
				}else{
					$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$logid."'");
				}
				$data['msg']=$nid?$name."成功".$msg:$name."失败";
			 

			}
			$joblink=array();
			$joblink[]="`email`='".trim($email)."',`is_email`='".$isemail."',`email_type`='".$emailtype."'";
			if($linktype==2){
				$joblink[]="`link_man`='".$link_man."',`link_moblie`='".$link_moblie."'";
			}
			if ($link_type){
				$joblink[]="`link_type`='".$link_type."'";
			}
			if($id){
				delfiledir("../data/upload/tel/".$this->uid);
				$linkid=$this->obj->DB_select_once("company_job_link","`uid`='".$this->uid."' and `jobid`='".$id."'","id");
				if($linkid['id']){
					if ($tblink==1){
						$this->obj->DB_update_all("company_job_link",@implode(',',$joblink),"`uid`='".$this->uid."'");
						$this->obj->DB_update_all("company_job","`link_type`='2'","`uid`='".$this->uid."'");
					}else {
						$this->obj->DB_update_all("company_job_link",@implode(',',$joblink),"`id`='".$linkid['id']."'");
					}
				}else{
					$joblink[]="`uid`='".$this->uid."'";
					$sid=$this->obj->DB_insert_once("company_job_link",@implode(',',$joblink).",`jobid`='".(int)$id."'");
					if($sid && $tblink==1){
						$this->obj->DB_update_all("company_job_link",@implode(',',$joblink),"`uid`='".$this->uid."'");
						$this->obj->DB_update_all("company_job","`link_type`='2'","`uid`='".$this->uid."'");
					}
				}
			}else if($nid>0){
				$joblink[]="`uid`='".$this->uid."'";
				$sid=$this->obj->DB_insert_once("company_job_link",@implode(',',$joblink).",`jobid`='".(int)$nid."'");
				if($sid && $tblink==1){
					$this->obj->DB_update_all("company_job_link",@implode(',',$joblink),"`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company_job","`link_type`='2'","`uid`='".$this->uid."'");
				}
			}
			$data['error']=0;
			
			if($this->config['com_job_status']=="0"){
				$data['url']='index.php?c=job';
			}else if($this->config['com_job_status']=="1"){
				if($id){
					$data['url_tg']='index.php?c=job_tg&id='.$id;
				} else if($nid > 0){
					$data['url_tg']='index.php?c=job_tg&id='.$nid;
				}
			}
			echo json_encode($data);die;
		}

		$this->yunset("job_pay",$job_pay);
		$this->yunset("layer",$data);
		$cacheList=$this->MODEL('cache')->GetCache(array('city','com','hy','job'));
		$this->yunset($cacheList);
		$this->yunset('header_title',"发布职位");
		$this->yunset('membernav',-1);
		$this->waptpl('jobadd');
	}

	function job_tg_action(){
		$this->company_satic();
		if($_GET['id']){
			$id = (int)$_GET['id'];
			$job = $this->obj->DB_select_once("company_job","`id`='".$id."' and `state`='1' and `status`='0'");
			
			if($job && is_array($job)){
				$this->yunset('job',$job);
			}else{
				$data['msg']="该职位未满足推广条件";
				$data['url']="index.php?c=job";
				$this->yunset("layer",$data);
			}
		}
		
		$backurl=Url('wap',array('c'=>'job'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"职位推广");
		$this->waptpl('job_tg');
	}
	function job_action(){
		$this->rightinfo();
		$jobM = $this->MODEL('job');
		$rows = $jobM->GetComjobList(array('uid'=>$this->uid),array('orderby'=>'`lastupdate`','desc'=>'desc'));
		$zp=$sh=$xj=0;
		if(is_array($rows)){
			$jobids = array();
		    foreach($rows as $value){
		    	$jobids[] = $value['id'];
		        if($value['state']==1 && $value['status']!=1){
		            $zp +=1;
		        }
		        if($value['state']!='1'){
		            $sh +=1;
		        }
		        if($value['status']=='1'){
		            $xj +=1;
		        }
		    }
		    $jobnum=$this->obj->DB_select_all("userid_job","`job_id` in(".pylode(',',$jobids).") and `com_id`='".$this->uid."' GROUP BY `job_id`","`job_id`,count(`id`) as `num`");
			foreach($rows as $k=>$v){
				$rows[$k]['jobnum']=0;/*应聘的简历数*/
				$rows[$k]['dcl'] = 0;/*待处理数量*/
				foreach($jobnum as $val){
					if($v['id']==$val['job_id']){
						$rows[$k]['dcl']=$this->obj->DB_select_num("userid_job","`com_id`=".$this->uid." and `is_browse`<=2 and `job_id` = '".$val['job_id']."' ");
						$rows[$k]['snum']=$val['num'];
					}
				}
				
 			}
		    
		}
		if($_GET['state']){
			$this->yunset("state",$_GET['state']);
		}
		if($_GET['state']){
			$this->yunset("status",$_GET['status']);
		}

		// print_r($rows);
		$this->yunset(array('zp'=>$zp,'sh'=>$sh,'xj'=>$xj));
		$this->yunset("rows",$rows);
		$this->company_satic();
		$backurl=Url('wap',array('c'=>'jobcolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"职位管理");
		$this->yunset('membernav',-1);
		$this->waptpl('job');
	}
	function ajaxjob_action(){
		$page = $_POST['page'];
	    $pagesize=5;
	    $offset = ($page-1)*$pagesize;

		$this->rightinfo();
		$jobM = $this->MODEL('job');

		if($_POST['state']==1 && $_POST['status']==3){
   			/*进行中*/


   			$WHERE = array('uid'=>$this->uid,'state'=>$_POST['state'],"status"=>array('neq','1'));/*status !=*/
   			// $WHERE .= " and status != '".$_POST['status']."' ";



   		}elseif( $_POST['status']==1){
   			/*已结束*/
   			$WHERE = array('uid'=>$this->uid,'status'=>$_POST['status']);
   		}else{
   			/*全部*/
   			$WHERE = array('uid'=>$this->uid);
   		}
		$rows = $jobM->GetComjobList2($WHERE,array('orderby'=>'`lastupdate`','desc'=>'desc'),$offset,$pagesize);
		
		$zp=$sh=$xj=0;
		if(is_array($rows)){
			$jobids = array();
		    foreach($rows as $value){
		    	$jobids[] = $value['id'];
		        if($value['state']==1 && $value['status']!=1){
		            $zp +=1;
		        }
		        if($value['state']!='1'){
		            $sh +=1;
		        }
		        if($value['status']=='1'){
		            $xj +=1;
		        }
		    }
		    $jobnum=$this->obj->DB_select_all("userid_job","`job_id` in(".pylode(',',$jobids).") and `com_id`='".$this->uid."' GROUP BY `job_id`","`job_id`,count(`id`) as `num`");
			foreach($rows as $k=>$v){
				$rows[$k]['jobnum']=0;/*应聘的简历数*/
				$rows[$k]['dcl'] = 0;/*待处理数量*/
				foreach($jobnum as $val){
					if($v['id']==$val['job_id']){
						$rows[$k]['dcl']=$this->obj->DB_select_num("userid_job","`com_id`=".$this->uid." and `is_browse`<=2 and `job_id` = '".$val['job_id']."' ");
						$rows[$k]['snum']=$val['num'];
					}
				}
				
 			}
		    
		}
		// print_r($rows);
		// $this->yunset(array('zp'=>$zp,'sh'=>$sh,'xj'=>$xj));
		// // $this->yunset("rows",$rows);
		// $this->company_satic();
		// $backurl=Url('wap',array('c'=>'jobcolumn'),'member');
		// $this->yunset('backurl',$backurl);
		// $this->yunset('header_title',"职位管理");
		// $this->yunset('membernav',-1);
		echo json_encode($rows);die;
		// $this->waptpl('job');
	}
	function refreshjob_action(){
		if($_GET['up']){
 			$nid=$this->obj->DB_update_all("company_job","`lastupdate`='".time()."'","`uid`='".$this->uid."' and `id`='".(int)$_GET['up']."'");
			if($nid){
				$this->obj->DB_update_all("company","`jobtime`='".time()."'","`uid`='".$this->uid."'");
				$job=$this->obj->DB_select_once("company_job","`id`='".(int)$_GET['up']."'","name");
				$job_sx=$this->obj->member_log("刷新职位《".$job['name']."》",1,4);
				$this->layer_msg('刷新职位成功！',9,0,$_SERVER['HTTP_REFERER']);
			}else{
				$this->layer_msg('刷新失败！',8,0,$_SERVER['HTTP_REFERER']);
			}
		}
	}
	function getserver_action(){
		if($this->config['alipay']=='1' &&  $this->config['alipaytype']=='1'){
			$paytype['alipay']='1';
		}
		if($paytype){
			$this->yunset("paytype",$paytype);
		}
		if($_GET['id']){
			$jobid=intval($_GET['id']);
			$info['id']=$jobid;
			$info['count']=1;
		}
		if($_GET['ids']){
			$info['id']=$_GET['ids'];
			$ids=@explode(",",$_GET['ids']);
			$count=count($ids);
			$info['count']=$count;
		}
		$server=intval($_GET['server']);
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		$this->yunset("info",$info);
		$this->yunset("statis",$statis);
		
		
 		$this->get_user();
 		
 		switch($server){
			case 1:$header_title="自动刷新";
			break;
			case 2:$header_title="职位置顶";
			break;
			case 3:$header_title="职位推荐";
			break;
			case 4:$header_title="紧急招聘";
			break;
			case 5:$header_title="刷新职位";
			break;
			case 7:$header_title="下载简历";
			break;
			case 8:$header_title="发布职位";
			break;
			case 9:$header_title="发布兼职";
			break;
			case 11:$header_title="邀请面试";
			break;
			case 12:$header_title="下载简历";
			break;
			case 13:$header_title="兼职刷新";
			break;
		}
		$this->yunset('header_title',$header_title);
		
		$this->waptpl('getserver');
	}


	function jobset_action(){
		if($_GET['status']){
			if($_GET['status']==2){
				$_GET['status']=0;
			}
			$this->obj->update_once('company_job',array('status'=>intval($_GET['status'])),array('uid'=>$this->uid,'id'=>intval($_GET['id'])));
			$this->obj->member_log("修改职位招聘状态",1,2);
			$this->get_user();
			$this->waplayer_msg("设置成功！");
		}
	}

	function jobdel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_delete_all("company_job","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'");
			if($nid){
				$newest=$this->obj->DB_select_once("company_job","`uid`='".$this->uid."' order by lastupdate DESC","`lastupdate`");
				$this->obj->DB_delete_all("userid_job","`com_id`='".$this->uid."' and `job_id`='".(int)$_GET['id']."'");
				$this->obj->DB_delete_all("look_job","`com_id`='".$this->uid."' and `jobid`='".(int)$_GET['id']."'");
				$this->obj->DB_delete_all("fav_job","`job_id`='".(int)$_GET['id']."'"," ");
				$this->obj->DB_delete_all("user_entrust_record","`jobid`='".(int)$_GET['id']."' and `comid`='".$this->uid."'","");
				$this->obj->DB_delete_all("report","`usertype`=1 and `type`=0 and `eid`='".(int)$_GET['id']."'","");
				$this->obj->update_once("company",array("jobtime"=>$newest['lastupdate']),array("uid"=>$this->uid));
				$this->obj->DB_delete_all("company_job_link","`uid`='".$this->uid."' and `jobid`='".(int)$_GET['id']."'");
				$this->obj->member_log("删除职位记录（ID:".(int)$_GET['id']."）",1,3);
				$this->waplayer_msg("删除成功！");
			}else{
				$this->waplayer_msg("删除失败！");
			}
		}
	}
	
	function partapply_action(){
		$this->rightinfo();
		
		if($_GET['del']){
			$nid=$this->obj->DB_delete_all("part_apply","`id`='".(int)$_GET['del']."' and `comid`='".$this->uid."'");
			if($nid){
				$data['msg']="删除成功!";
				$this->obj->member_log("删除兼职报名",6,3);
			}else{
				$data['msg']="删除失败！";
			}
			$data['url']='index.php?c=partapply';
			$this->yunset("layer",$data);
		}
		
		if((int)$_GET['id']&&(int)$_GET['status']){
			$nid=$this->obj->update_once("part_apply",array('status'=>(int)$_GET['status']),array("comid"=>$this->uid,"id"=>(int)$_GET['id']));
			if($nid){
			    $this->obj->member_log("更改兼职报名状态（ID:".(int)$_GET['id']."）",6,2);
				$this->waplayer_msg("操作成功！");
			}else{
				$this->waplayer_msg("操作失败！");
			}
		}
		$urlarr=array("c"=>"partapply","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("part_apply","`comid`='".$this->uid."'",$pageurl,"10");
		if(is_array($rows)&&$rows){
			include PLUS_PATH."/user.cache.php";
			include(CONFIG_PATH."db.data.php");
			unset($arr_data['sex'][3]);
			$this->yunset("arr_data",$arr_data);
			foreach($rows as $val){
				$jobid[]=$val['jobid'];
				$uid[]=$val['uid'];
			}
			$joblist=$this->obj->DB_select_all("partjob","`id` in(".pylode(',',$jobid).")","`id`,`name`");
			$uselist=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).") and `r_status`<>'2'","`name`,`sex`,`edu`,`uid`,`birthday`,`telphone`,`def_job`,`birthday`");
		}
		foreach($rows as $key=>$val){
			foreach($joblist as $k=>$v){
				if($val['jobid']==$v['id']){
					$rows[$key]['job_name']=$v['name'];
				}
			}
			foreach($uselist as $k=>$va){
				if($val['uid']==$va['uid']){
					$rows[$key]['username']=$va['name'];
					$rows[$key]['moblie']=$va['telphone'];
					$rows[$key]['sex']=$arr_data['sex'][$va['sex']];
					$rows[$key]['edu']=$userclass_name[$va['edu']];
					$rows[$key]['age']=ceil((time()-strtotime($va['birthday']))/31104000);
					$rows[$key]['resumeid']=$va['def_job'];
					$rows[$key]['birthday']=$va['birthday'];
				}
			}
		}
		$this->yunset("rows",$rows);
		$backurl=Url('wap',array('c'=>'part'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"兼职报名");
		$this->get_user();
		$this->waptpl('partapply');
	}
	
	function hr_action(){
		$this->rightinfo();

		$urlarr=array("c"=>"hr","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		if($_GET['type'] == 4){
			$this->yunset('header_title',"不合适");
			$rows=$this->obj->DB_select_all("userid_job"," (`is_browse`=4 and `com_id`='".$this->uid."' ) OR ( `is_browse`=7  and `com_id`='".$this->uid."')  ORDER BY is_browse asc,datetime desc");

		}else{
			$this->yunset('header_title',"已报名");
			$SQL = "SELECT * FROM phpyun_userid_job WHERE com_id = '".$this->uid."' and ". "  job_id NOT IN (SELECT jobid FROM phpyun_userid_msg) LIMIT 0 , 30";
			$query=$this->db->query($SQL);
			while($row=$this->db->fetch_array($query)){$rows[]=$row;}

		}
		
		if(is_array($rows) && !empty($rows)){
			$uid=$eid=array();
			foreach($rows as $v){
				$uid[]=$v['uid'];
				$eid[]=$v['eid'];
			}
			$userrows=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).") and `r_status`<>'2'","`name`,`sex`,`edu`,`uid`,`exp`,`telphone`,`resume_photo`");
			$expect=$this->obj->DB_select_all("resume_expect","`id` in (".pylode(",",$eid).")","`id`,`job_classid`,`salary`,`height_status`");
			
			if(is_array($userrows)){
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				$expectinfo=array();
				foreach($expect as $key=>$val){
					$jobids=@explode(',',$val['job_classid']);
					$jobname=array();
					foreach($jobids as $v){
						$jobname[]=$job_name[$v];
					}
					$expectinfo[$val['id']]['jobname']=@implode('、',$jobname);
					$expectinfo[$val['id']]['salary']=$userclass_name[$val['salary']];
					$expectinfo[$val['id']]['height_status']=$val['height_status'];
				}
				foreach($rows as $k=>$v){
					$rows[$k]['jobname']=$expectinfo[$v['eid']]['jobname'];
					$rows[$k]['salary']=$expectinfo[$v['eid']]['salary'];
					$rows[$k]['height_status']=$expectinfo[$v['eid']]['height_status'];
					/*获取该投递记录的简历信息*/
					$expectinfo=$this->obj->DB_select_once("resume_expect","`id` =".$v['eid']." ");
					$rows[$k]['name']=$expectinfo['uname'];
					$rows[$k]['edu']=$userclass_name[$expectinfo['edu']];
					$rows[$k]['exp']=$userclass_name[$expectinfo['exp']];
					$rows[$k]['sex']=$arr_data['sex'][$expectinfo['sex']];
					if($expectinfo['birthday']){
					    $a=date('Y',strtotime($expectinfo['birthday']));
					    $rows[$k]['age']=date("Y")-$a;
					}else{
						$rows[$k]['age']='无';
					}
					/*jam判断该企业是否已评价过该用户*/
					$comment = $this->obj->DB_select_once("comments","`uid`='".$v['uid']."' " );
					if(empty($comment)){
						/*未评价*/
						$rows[$k]['comment'] = 1;
					}
					foreach($userrows as $val){
						if($v['uid']==$val['uid']){
							
							$rows[$k]['telphone']=$val['telphone'];
							
							$rows[$k]['resume_photo']=$this->config['sy_weburl'].'/'.trim($val['resume_photo'],'.');/*用户头像*/
							/*jam添加每一条申请都要有一条面试邀请s*/
							$userid_msg=$this->obj->DB_select_once("userid_msg","`fid`='".$this->uid."' and `uid` ='".$val['uid']."' and `jobid` ='".$v['job_id']."' ","uid,jobid,is_browse");
							if($userid_msg){
								$rows[$k]['userid_msg']=1;
								$rows[$k]['is_browse2']=$userid_msg['is_browse'];
								// unset($rows[$k]);
							}
							
							/*jam添加每一条申请都要有一条面试邀请s*/
						}
					}
					// foreach($userid_msg as $val){
					// 	if($v['uid']==$val['uid']){
					// 		$rows[$k]['userid_msg']=1;
					// 	}
					// }
				}
			}
		}
		// print_r($rows);
		// $this->yunset("rows",$rows);
		$backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		$this->yunset('backurl',$backurl);
		
		$this->get_user();
		$this->waptpl('hr');
	}
	function hrajax_action(){
		// $com_id= $_POST['comid'];
	      $page = $_POST['page'];
	      // $type = $_POST['type'];  //1最新  2好评 3差评
	      $pagesize=5;

	      $offset = ($page-1)*$pagesize;
     	$rows = array();
		if($_POST['state'] == 4){
			$rows=$this->obj->DB_select_all("userid_job"," (`is_browse`=4 and `com_id`='".$this->uid."' ) OR ( `is_browse`=7  and `com_id`='".$this->uid."')  ORDER BY is_browse asc,datetime desc limit ". $offset. ", " . $pagesize);

		}else{
			$SQL = "SELECT * FROM phpyun_userid_job WHERE com_id = '".$this->uid."' and ". "  job_id NOT IN (SELECT jobid FROM phpyun_userid_msg)  ORDER BY is_browse asc,datetime desc limit ". $offset. ", " . $pagesize;
			$query=$this->db->query($SQL);
			while($row=$this->db->fetch_array($query)){$rows[]=$row;}

		}
		
		if(is_array($rows) && !empty($rows)){
			$uid=$eid=array();
			foreach($rows as $v){
				$uid[]=$v['uid'];
				$eid[]=$v['eid'];
			}
			$userrows=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).") and `r_status`<>'2'","`name`,`sex`,`edu`,`uid`,`exp`,`telphone`,`resume_photo`");
			$expect=$this->obj->DB_select_all("resume_expect","`id` in (".pylode(",",$eid).")","`id`,`job_classid`,`salary`,`height_status`");
			
			if(is_array($userrows)){
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				$expectinfo=array();
				foreach($expect as $key=>$val){
					$jobids=@explode(',',$val['job_classid']);
					$jobname=array();
					foreach($jobids as $v){
						$jobname[]=$job_name[$v];
					}
					$expectinfo[$val['id']]['jobname']=@implode('、',$jobname);
					$expectinfo[$val['id']]['salary']=$userclass_name[$val['salary']];
					$expectinfo[$val['id']]['height_status']=$val['height_status'];
				}
				foreach($rows as $k=>$v){
					$rows[$k]['datetime']=date('Y-m-d H:m',$v['datetime']);
					$rows[$k]['jobname']=$expectinfo[$v['eid']]['jobname'];
					$rows[$k]['salary']=$expectinfo[$v['eid']]['salary'];
					$rows[$k]['height_status']=$expectinfo[$v['eid']]['height_status'];
					/*获取该投递记录的简历信息*/
					$expectinfo=$this->obj->DB_select_once("resume_expect","`id` =".$v['eid']." ");
					$rows[$k]['name']=$expectinfo['uname'];
					$rows[$k]['edu']=$userclass_name[$expectinfo['edu']];
					$rows[$k]['exp']=$userclass_name[$expectinfo['exp']];
					$rows[$k]['sex']=$arr_data['sex'][$expectinfo['sex']];
					if($expectinfo['birthday']){
					    $a=date('Y',strtotime($expectinfo['birthday']));
					    $rows[$k]['age']=date("Y")-$a;
					}else{
						$rows[$k]['age']='无';
					}
					/*jam判断该企业是否已评价过该用户*/
					$comment = $this->obj->DB_select_once("comments","`uid`='".$v['uid']."' " );
					if(empty($comment)){
						/*未评价*/
						$rows[$k]['comment'] = 1;
					}
					foreach($userrows as $val){
						if($v['uid']==$val['uid']){
							
							$rows[$k]['telphone']=$val['telphone'];
							
							$rows[$k]['resume_photo']=$this->config['sy_weburl'].'/'.trim($val['resume_photo'],'.');/*用户头像*/
							/*jam添加每一条申请都要有一条面试邀请s*/
							$userid_msg=$this->obj->DB_select_once("userid_msg","`fid`='".$this->uid."' and `uid` ='".$val['uid']."' and `jobid` ='".$v['job_id']."' ","uid,jobid,is_browse");
							if($userid_msg){
								$rows[$k]['userid_msg']=1;
								$rows[$k]['is_browse2']=$userid_msg['is_browse'];
								// unset($rows[$k]);
							}
							
							/*jam添加每一条申请都要有一条面试邀请s*/
						}
					}
					// foreach($userid_msg as $val){
					// 	if($v['uid']==$val['uid']){
					// 		$rows[$k]['userid_msg']=1;
					// 	}
					// }
				}
			}
		}
		 echo json_encode($rows);die;
	}
	function hrset_action(){
		$id=(int)$_GET['id'];
		$browse=(int)$_GET['is_browse'];

 		if($id&&$browse){
			$nid=$this->obj->update_once("userid_job",array('is_browse'=>$browse),array("com_id"=>$this->uid,"id"=>$id));
			$this->obj->member_log("更改申请职位状态（ID:".$id."）",6,2);
			
			if($browse==4){
				$resumeuid=$this->obj->DB_select_once("userid_job","`id`='".$id."'",'eid,job_id');
				$resumeexp=$this->obj->DB_select_once("resume_expect","`id`='".$resumeuid['eid']."' and `r_status`<>'2' and `status`='1'",'uid,uname');
				$uid=$this->obj->DB_select_once("resume","`uid`='".$resumeexp['uid']."'","telphone,email");
				$comjob=$this->obj->DB_select_once("company_job","`uid`='".$this->uid."' and `id`='".$resumeuid['job_id']."'","name,com_name");
				$data['uid']=$resumeexp['uid'];
				$data['cname']=$this->username;
				$data['name']=$resumeexp['uname'];
				$data['type']="sqzwhf";
				$data['cuid']=$this->uid;
				$data['company']=$comjob['com_name'];
				$data['jobname']=$comjob['name'];
				if($this->config['sy_msg_sqzwhf']=='1'&&$uid["telphone"]&&$this->config["sy_msguser"]&&$this->config["sy_msgpw"]&&$this->config["sy_msgkey"]&&$this->config['sy_msg_isopen']=='1'){$data["moblie"]=$uid["telphone"]; }
				if($this->config['sy_email_sqzwhf']=='1'&&$uid["email"]&&$this->config['sy_email_set']=="1"){$data["email"]=$uid["email"]; }
				if($data["email"]||$data['moblie']){
					$notice = $this->MODEL('notice');
					$notice->sendEmailType($data);
					$notice->sendSMSType($data);
				}
			}
			$nid?$this->waplayer_msg("操作成功！"):$this->waplayer_msg("操作失败！");
		}
	}
	function delhr_action(){
		$nid=$this->obj->DB_delete_all("userid_job","`id`='".(int)$_GET['id']."' and `com_id`='".$this->uid."'");
		$this->obj->member_log("删除申请职位记录（ID:".(int)$_GET['id']."）",6,3);
		$nid?$this->waplayer_msg("删除成功！"):$this->waplayer_msg("删除失败！");
	}
	function password_action(){
		$this->rightinfo();
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"修改密码");
		$this->get_user();
		$this->waptpl('password');
	}
	
	function time_action(){
		$com=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		$this->yunset("statis",$statis);
		$this->yunset("com",$com);
		
		$pser=$this->obj->DB_select_all("company_service","`display`='1'" );
		$this->yunset("pser",$pser);
		
		$banks=$this->obj->DB_select_all("bank");
		$this->yunset("banks",$banks);
		
		if($this->config['com_vip_type'] == 2){
			$where = '`type` = 1 ';
		}
		else if($this->config['com_vip_type'] == 1){
			$where = '`type` = 2';
		}
		else{
			
			$where = '`type` = 2 ';
		}

		$rows=$this->obj->DB_select_all("company_rating","`category`='1' and `display`='1' and `service_price` > 0  and {$where} order by `type` asc,`sort` desc");
		$row=$this->obj->DB_select_once("company_rating","`category`='1' and `display`='1' and `service_price` > 0  and {$where} order by `type` asc,`sort` desc");

		if($rows&&is_array($rows)){
			foreach ($rows as $k=>$v){
				$rname=array();
				if($v['job_num']>0){$rname[]='发布职位:'.$v['job_num'].'份';}
				if($v['breakjob_num']>0){$rname[]='刷新职位:'.$v['breakjob_num'].'份';}
				if($v['resume']>0){$rname[]='下载简历:'.$v['resume'].'份';}
				if($v['interview']>0){$rname[]='邀请面试:'.$v['interview'].'份';}
				if($v['part_num']>0){$rname[]='发布兼职职位:'.$v['part_num'].'份';}
				if($v['breakpart_num']>0){$rname[]='刷新兼职职位:'.$v['breakpart_num'].'份';}
				
				if($v['msg_num']>0){$rname[]='短信数:'.$v['msg_num'].'份';}
				$rows[$k]['rname']=@implode('+',$rname);
			}
		}
		$this->yunset("rows",$rows);	
		$this->yunset("row",$row);
		$this->yunset("js_def",4);
		
		
		$this->yunset('header_title',"购买会员");

		$this->get_user();
		if($this->config['com_vip_type'] == 1 || $this->config['com_vip_type'] == 0){
			$this->waptpl('member_time');
		}else if($this->config['com_vip_type'] == 2){
			$this->waptpl('member_rating');
		}
	}
	function rating_action(){
		$com=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		
		$this->yunset("statis",$statis);
		$this->yunset("com",$com);
		
		$pser=$this->obj->DB_select_all("company_service","`display`='1'" );
		$this->yunset("pser",$pser);
		
		$banks=$this->obj->DB_select_all("bank");
		$this->yunset("banks",$banks);
		
		if($this->config['com_vip_type'] == 2){
			$where = '`type` = 1 ';
		}
		else if($this->config['com_vip_type'] == 1){
			$where = '`type` = 2';
		}
		else{
			
			$where = '`type` = 1 ';
		}

		$rows=$this->obj->DB_select_all("company_rating","`category`='1' and `display`='1' and `service_price` > 0 and {$where} order by `type` asc,`sort` desc");
		
		if($rows&&is_array($rows)){
			foreach ($rows as $k=>$v){
				$rname=array();
				if($v['job_num']>0){$rname[]='发布职位:'.$v['job_num'].'份';}
				if($v['breakjob_num']>0){$rname[]='刷新职位:'.$v['breakjob_num'].'份';}
				if($v['resume']>0){$rname[]='下载简历:'.$v['resume'].'份';}
				if($v['interview']>0){$rname[]='邀请面试:'.$v['interview'].'份';}
				if($v['part_num']>0){$rname[]='发布兼职职位:'.$v['part_num'].'份';}
				if($v['breakpart_num']>0){$rname[]='刷新兼职职位:'.$v['breakpart_num'].'份';}
				
				if($v['msg_num']>0){$rname[]='短信数:'.$v['msg_num'].'份';}

				
				if($this->config['com_vip_type'] == 1){
					$rows[$k]['rname'] = '时间模式会员，有效时间内，发布职位、下载简历等操作不受限制！';
				}else{
					$rows[$k]['rname']=@implode('+',$rname);
				}
			}
			
 		}
		$this->yunset("rows",$rows);
		$this->yunset("row",$rows[0]);
		$this->yunset("js_def",4);
		
		
		$this->yunset('header_title',"购买会员");
		$this->get_user();
		
 		$this->waptpl('member_rating');
		if($this->config['com_vip_type'] == 2 || $this->config['com_vip_type'] == 0){
			$this->waptpl('member_rating');
		}else if($this->config['com_vip_type'] == 1){
			$this->waptpl('member_time');
		}

	}
	function added_action(){
		$id=intval($_GET['id']);
		$banks=$this->obj->DB_select_all("bank");
		$this->yunset("banks",$banks);
		
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		$rows=$this->obj->DB_select_all("company_service","`display`='1' order by sort desc" );
 		
		if($id){
			$info=$this->obj->DB_select_all("company_service_detail","`type` = '$id' order by `sort`desc");
			$service_one = $this->obj->DB_select_once("company_service_detail","`type` = '".$id."' order by `sort`desc");
		}else{
			$row=$this->obj->DB_select_once("company_service","`display`='1'  order by sort desc","id");
			$info=$this->obj->DB_select_all("company_service_detail","`type` = '".$row['id']."' order by `sort`desc");
			$service_one = $this->obj->DB_select_once("company_service_detail","`type` = '".$row['id']."' order by `sort`desc");
		}
		
		if($statis['rating']>0){
			if($statis['vip_etime']>time()){
				$days=round(($statis['vip_etime']-mktime())/3600/24) ;
				$this->yunset("days",$days);
			}
		}
		
		if ($statis){
			$rating=$statis['rating'];
			$discount=$this->obj->DB_select_once("company_rating","`id`=$rating");
			$this->yunset("discount",$discount);
		}
		$this->yunset("statis",$statis);
		
		$this->yunset("info",$info);
		$this->yunset("p_once",$service_one);
		
		$this->yunset("rows",$rows);
		$this->yunset("js_def",4);
		$this->yunset('header_title',"增值服务");
		$this->get_user();
		$this->waptpl('added');

	}
	
	function pay_action(){
 		
 		if($_GET['type'] && $_GET['type'] == 'show'){
 			/*显示我的钱包页面*/
 			$this->yunset('header_title',"我的钱包");
 			$this->yunset('types',"show");
 		}else{
 			if($this->config['alipay']=='1' &&  $this->config['alipaytype']=='1'){
				$paytype['alipay']='1';
			}
			$banks=$this->obj->DB_select_all("bank");
			$this->yunset("banks",$banks);
			if($this->config['bank']=='1' &&  $banks){
				$paytype['bank']='1';
			}
			
			if($paytype){
				$statis=$this->company_satic();
				if($_POST['usertype']=='price'){
					
					$id=(int)$_POST['id'];
					if ($id){

						$rows=$this->obj->DB_select_once("company_rating","`service_price`<>'' and `service_time`>'0' and `id`='".$id."' and `display`='1' and `category`=1 order by sort desc","name,time_start,time_end,service_price,yh_price,id");

						
						if((int)$rows['service_price'] == 0){

	 					
							$ratingM =  $this->MODEL('rating');
							$value=$ratingM->rating_info($id);
					 
							$status=$this->obj->DB_update_all('company_statis',$value,"`uid`= '".$this->uid."' ");
							$this->obj->DB_update_all("company_job","`rating`= {$id} ","`uid`='".$this->uid."'");

							if($status){
								$data['msg']="会员服务购买成功！";
								$data['url']='index.php?c=com';
								$this->yunset("layer",$data);
							}else{
								$data['msg']="服务购买失败，请稍后重试！";
								$data['url']=$_SERVER['HTTP_REFERER'];
								$this->yunset("layer",$data);
							}	

						}

					}else{
						$typeWhere = "`type` = 1";
						if($this->config['com_vip_type'] == 1){
							$typeWhere = '`type` = 2';
						}
						else if($this->config['com_vip_type'] == 0){
							$typeWhere = '`type` in (1,2) ';
						}
						$rows=$this->obj->DB_select_all("company_rating","`service_price`<>'' and `service_time`>'0' and `display`='1' and `category`=1 and {$typeWhere} order by sort desc","name,time_start,time_end,service_price,yh_price,id");
					}
					$this->yunset("rows",$rows);
				}elseif($_POST['usertype']=='service'){
	 				if($data['msg'] == ''){
					$id=(int)$_POST['id'];
					if($id){
						$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
						if ($statis){
							$rating=$statis['rating'];
							$discount=$this->obj->DB_select_once("company_rating","`id`='".$rating."'");
							$this->yunset("discount",$discount);
						}
						$rows=$this->obj->DB_select_once("company_service_detail","`id`='".$id."'","type,service_price,id");
						if ($rows['type']){
							$service=$this->obj->DB_select_once("company_service","`id`='".$rows['type']."'");
							$this->yunset("service",$service);
						}
						$this->yunset("rows",$rows);
					}else{
						$data['msg']="请选择套餐！";
						$data['url']=$_SERVER['HTTP_REFERER'];
						$this->yunset("layer",$data);
					}}else{
						$data['url']=$_SERVER['HTTP_REFERER'];
						$this->yunset("layer",$data);
					}

				}elseif($_GET['id']){
					$order=$this->obj->DB_select_once("company_order","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."'");
					if(empty($order)){
						$this->ACT_msg($_SERVER['HTTP_REFERER'],"订单不存在！");
					}elseif($order['order_state']!='1'){
						header("Location:index.php?c=paylog");
					}else{
						$this->yunset("order",$order);
					}
				}
				$this->yunset("statis",$statis);
				$remark="姓名：\n联系电话：\n留言：";
				$this->yunset("paytype",$paytype);
				$this->yunset("remark",$remark);
				$this->yunset("js_def",4);
			}else{
				$data['msg']="暂未开通手机支付，请移步至电脑端充值！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				$this->yunset("layer",$data);
			}
			$nopayorder=$this->obj->DB_select_num("company_job_order","`uid`=".$this->uid." and `order_state`=1");
			$this->yunset('nopayorder',$nopayorder);
			$this->yunset($this->MODEL('cache')->GetCache(array('integralclass')));
			$this->yunset('header_title',"充值");
 		}
 		$this->get_user();
		$this->waptpl('pay');
		
	}
	
	function payment_action(){
		if($this->config['alipay']=='1' &&  $this->config['alipaytype']=='1'){
			$paytype['alipay']='1';
		}
		$banks=$this->obj->DB_select_all("bank");
		$this->yunset("banks",$banks);
		if($this->config['bank']=='1' &&  $banks){
			$paytype['bank']='1';
		}
		
		if($paytype){
			$statis=$this->company_satic();
			if($_GET['id']){
				$order=$this->obj->DB_select_once("company_job_order","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."'");
				if(empty($order)){
					$this->ACT_msg($_SERVER['HTTP_REFERER'],"订单不存在！");
				}elseif($order['order_state']!='1'){
					header("Location:index.php?c=paylog");
				}else{

					$this->yunset("order",$order);
				}
			}
			$this->yunset("statis",$statis);
 			$this->yunset("paytype",$paytype);
 			$this->yunset("js_def",4);
		}else{
			$data['msg']="暂未开通手机支付，请移步至电脑端充值！";
			$data['url']=$_SERVER['HTTP_REFERER'];
			$this->yunset("layer",$data);
		}


		$this->yunset('header_title',"订单确认");
		$this->get_user();
		$this->waptpl('payment');
	}

	
	function company_satic(){
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'"); 
		if($statis['rating']){
			$rating=$this->obj->DB_select_once("company_rating","`id`='".$statis['rating']."'"); 
		}
		if($statis['vip_etime'] < time()){
			if($statis['vip_etime'] > '1'){ 
				$nums=0;
			}else if($statis['vip_etime'] < '1' && $statis['rating']!="0"){
				$nums=1;
			}else{
				$nums=0;
			}
			if($nums == 0){
				if($this->config['com_vip_done']=='0'){
					$data['job_num']=$data['down_resume']=$data['invite_resume']=$data['editjob_num']=$data['breakjob_num']=$data['part_num']=$data['editpart_num']=$data['breakpart_num']=$data['zph_num']=='0';
					$data['oldrating_name']=$statis['rating_name'];
					$statis['rating_name']=$data['rating_name']="过期会员";
					$statis['rating_type']=$statis['rating']=$data['rating_type']=$data['rating']="0"; 
					$where['uid']=$this->uid;
					$this->obj->DB_update_all("company_job","`rating`='0'","`uid`='".$this->uid."'");
					$this->obj->update_once("company_statis",$data,$where);
				}elseif ($this->config['com_vip_done']=='1'){
					$ratingM = $this->MODEL('rating');
					$rat_value=$ratingM->rating_info();
					$this->obj->DB_update_all("company_job","`rating`='".$this->config['com_rating']."'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company_statis",$rat_value,"`uid`='".$this->uid."'");
				}
			}
		}
		if($statis['autotime']>=time()){
			$statis['auto'] = 1;
		}
		
		if($statis['vip_etime']>time() || $statis['vip_etime']==0){
			if($statis['rating_type']=="2"){
				$addjobnum=$addpartjobnum=$editjobnum=$editpartjobnum='1';
			}else if($statis['rating_type']=="1"){
				if($statis['job_num']>0){
					$addjobnum='1';
				}else{
 					$addjobnum='2';
				}
				if($statis['part_num']>0){
					$addpartjobnum='1';
				}else{
					$addpartjobnum='2';
				}
			}else{
				$addjobnum=$addpartjobnum=$editjobnum=$editpartjobnum='0';
			}
		}else {
			$addjobnum=$addpartjobnum='0';
		}
		/*jam添加,允许企业一直发布职位*/
		$addjobnum = 1;
		$statis['addjobnum']=$addjobnum;
		$statis['addpartjobnum']=$addpartjobnum;
		$statis['pay_format']=number_format($statis['pay'],2);
		$statis['integral_format']=number_format($statis['integral']);
		$this->yunset("addjobnum",$addjobnum);
		$this->yunset("addpartjobnum",$addpartjobnum);
		$this->yunset("statis",$statis);
		$this->yunset("rating",$rating);
		return $statis;
	}
	/*jam添加员工认证列表*/
	function employee_list_action(){
		// $sq_list=$this->obj->DB_select_all("company_user","`companyid`='".$this->uid."'");

		$urlarr=array("c"=>"hr","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$sq_list=$this->get_page("company_user","`companyid`='".$this->uid."' ORDER BY id desc",$pageurl,"10");

		foreach ($sq_list as $key => $value) {
			$userinfo  = $this->obj->DB_select_once("member","`uid`='".$value['uid']."'");
			$sq_list[$key]['user_name'] = $userinfo['realname_jam'];
			$sq_list[$key]['mobile_jam'] = $userinfo['mobile_jam'];
		}
		$this->yunset('sq_list',$sq_list);
		$this->yunset('header_title',"员工认证");
		$this->get_user();
		$this->waptpl('employee_list');
	}

	/*jam添加通过员工认证*/
	function allow_yg_action(){

		if(!isset($_POST['yg_id'])){
			$msg = -1;
		}elseif(empty($_POST['yg_num'])){
			$msg = -2;
		}else{
			$yuangong  = $this->obj->DB_select_once("company_user","`id`='".$_POST['yg_id']."'");
			$memberinfo = $this->obj->DB_select_once("member","`uid`='".$yuangong['uid']."' ");
			
			if(empty($yuangong)){
				$msg = -1;
			}else{

				/*jam更新认证状态和员工工号，工号添加到member表*/
				$this->obj->DB_update_all("company_user","`status`=2","`id`='".$_POST['yg_id']."'");
				$this->obj->DB_update_all("member","`yuangong_num`='".$_POST['yg_num']."'","`uid`='".$yuangong['uid']."'");
				/*同时插入到员工表中*/
				$datas['employe_name'] = $memberinfo['realname_jam'];
				$datas['employe_mobile'] = $memberinfo['mobile_jam'];
				$datas['employe_sex'] = $memberinfo['sex'];
				$datas['gong_number'] = $_POST['yg_num'];
				$datas['position_status'] =1;
				$datas['company_id'] = $yuangong['companyid'];
				$datas['add_time'] = time();
				
				$employe_id=$this->obj->insert_into("employe",$datas);
				$this->obj->DB_update_all("company_user","`employee_id`='".$employe_id."'","`id`='".$_POST['yg_id']."'");

				$msg = 1;
			}
		}
	    echo json_encode($msg);
	    exit;
		
	}

	/*jam拒绝员工认证*/
	function refuse_yg_action(){
		if(!isset($_POST['yg_id'])){
			$msg = -1;
		}else{
			$yuangong  = $this->obj->DB_select_once("company_user","`id`='".$_POST['yg_id']."'");
			if(empty($yuangong)){
				$msg = -1;
			}else{
				/*jam更新认证状态*/
				$this->obj->DB_update_all("company_user","`status`=3","`id`='".$_POST['yg_id']."'");
				$msg = 1;
			}
		}
	    echo json_encode($msg);
	    exit;
		
	}
	
	/*jam添加职位详情*/
	function job_detail_action(){
		include(CONFIG_PATH."db.data.php");
		unset($arr_data['sex'][3]);
		$this->yunset("arr_data",$arr_data);
		$id=intval($_GET['id']);
		$company_job  = $this->obj->DB_select_once("company_job","`id`='".$id."'");
		
		$this->rightinfo();
		
		/*报名总数*/
		$SQL1 = "SELECT count(*) as num FROM phpyun_userid_job WHERE job_id = '".$id."' and ". "  uid NOT IN (SELECT uid FROM phpyun_userid_msg) and ". "  job_id NOT IN (SELECT jobid FROM phpyun_userid_msg)";
		$query1=$this->db->query($SQL1);
		while($row1=$this->db->fetch_array($query1)){$bm_all=$row1['num'];}
		

		/*面试总数*/
		$SQL = "SELECT count(*) as num FROM phpyun_userid_job as uj left join phpyun_userid_msg as um on uj.`uid` = um.`uid` and uj.`job_id`=um.`jobid` WHERE um.`jobid`='".$id."' and um.`is_browse`=3 ";
		$query=$this->db->query($SQL);
		while($row=$this->db->fetch_array($query)){$returns=$row['num'];}

		/*成功总数*/
		$success_all = $this->obj->DB_select_num("userid_job","`job_id`='".$id."' and is_browse =9");
		$this->yunset('bm_all',$bm_all);
		$this->yunset('ms_all',$returns);
		$this->yunset('success_all',$success_all);

		
		// print_r($rows);
		$CacheArr=$this->MODEL('cache')->GetCache(array('city','user','hy','job'));
		$this->yunset('userclass_name',$CacheArr['userclass_name']);
		
		$this->yunset('id',$id);
		$this->yunset('company_job',$company_job);
		$this->yunset('header_title',"职位详情");
		$this->get_user();
		$this->waptpl('job_detail');
	}
/*jam添加职位详情*/
	function job_detailajax_action(){
		include(CONFIG_PATH."db.data.php");
		unset($arr_data['sex'][3]);
		$CacheArr=$this->MODEL('cache')->GetCache(array('city','user','hy','job'));

		$id= $_POST['id'];
		$page = $_POST['page'];
		$type = $_POST['type'];  //1最新  2好评 3差评
		$pagesize=5;
		$offset = ($page-1)*$pagesize;

     	if($_POST['type'] == 1){
			$rows=array();
		}elseif($_POST['type'] == 2){
			/*userid_job有记录，userid_msg没有记录，就是没有面试邀请的,报名的*/
			$SQL = "SELECT * FROM phpyun_userid_job WHERE job_id = '".$id."' and ". "  uid NOT IN (SELECT uid FROM phpyun_userid_msg) and ". "  job_id NOT IN (SELECT jobid FROM phpyun_userid_msg) order by id desc limit ". $offset. ",". $pagesize;
			
		}elseif($_POST['type'] == 3){
			/*userid_job有记录，userid_msg有记录，就是有面试邀请的*/
			$SQL = "SELECT uj.* FROM phpyun_userid_job as uj left join phpyun_userid_msg as um on uj.`uid` = um.`uid` and uj.`job_id`=um.`jobid` WHERE um.`jobid`='".$id."' and um.`is_browse`=3  order by uj.id desc limit ". $offset. ",". $pagesize;
			
		}elseif($_POST['type'] == 4){
			/*userid_job is_browse是9的,已经确认入职的*/
			$SQL = "SELECT * FROM phpyun_userid_job WHERE `job_id`='".$id."' and `is_browse`=9  order by id desc limit ". $offset. ",". $pagesize;
		}
		$query=$this->db->query($SQL);
		while($data = $this->db->fetch_array($query)) {
 				$rows[] = $data;
		}

		$newarr =array();
		foreach ($rows as $key => $value) {
			
			$resume_info =  $this->obj->DB_select_once("resume_expect","`id`='".$value['eid']."'");
			$value['head_img'] = $resume_info['photo'];
			$value['sex'] = $arr_data['sex'][$resume_info['sex']];
			$value['name'] = $resume_info['uname'];
			$value['exp'] = $CacheArr['userclass_name'][$resume_info['exp']];/*工作经验*/
			$value['edu'] = $CacheArr['userclass_name'][$resume_info['edu']];/*最高学历*/

			if(empty($resume_info['photo'])){
				$resume_img = $this->obj->DB_select_once("resume","`uid`='".$value['uid']."'",'resume_photo');
				$photo = $resume_img['resume_photo'];
			}else{
				$photo = $resume_info['photo'];
			}

			if(strpos($photo,'http://thirdwx.qlogo.cn') !== false){ 
			 	$value['resume_photo']=$resume_info['photo'];/*用户头像*/
			}else{
				$value['resume_photo']=$this->config['sy_weburl'].'/'.trim($photo,'.');/*用户头像*/
			}
			

			$user=$this->obj->DB_select_once("resume","`uid`='".$value['uid']."'");
			$value['phone'] = $user['telphone'];/*最高学历*/
			if($user['birthday']){
			    $a=date('Y',strtotime($user['birthday']));
			    $value['age']=date("Y")-$a;
			}else{
				$value['age']='无';
			}
			$newarr[]=$value;
		}
		
		 echo json_encode($newarr);die;
	}

	/*jam添加企业个人资料修改*/
	function person_info_action(){
		include(CONFIG_PATH."db.data.php");
		unset($arr_data['sex'][3]);
		$this->yunset("arr_data",$arr_data);
		if($_POST['submit']){
			$this->cookie->SetCookie("delay", "", time() - 60);
			$_POST=$this->post_trim($_POST);
			if($data['msg']==''){

 				if($_POST['linkman']==""){
					$data['msg']='用户名不能为空！';
				}
				
				elseif($_POST['linkjob']==""){
					$data['msg']='从事行业不能为空！';
				}
				
				else if($_POST['linkphone']==""&&$_POST['linktel']==""){
					$data['msg']='手机或电话必填一项！';
				} 
				
			}
			if($data['msg']==''){

				delfiledir("../data/upload/tel/".$this->uid);
				$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
				$Member=$this->MODEL("userinfo");
				
				if($_POST['linktel']){
					$moblieNum = $Member->GetMemberNum(array("moblie"=>$_POST['linktel'],"`uid`<>'".$this->uid."'"));
					if(!CheckMoblie($_POST['linktel'])){
						$data['msg']='手机号码格式错误！';
					}elseif($moblieNum>0){
						$data['msg']='手机号码已存在！';
					}else{
						$mvalue['moblie']=$_POST['linktel'];
					}

				}
				
				if($_POST['linkmail']){
					$emailNum = $Member->GetMemberNum(array("email"=>$_POST['linkmail'],"`uid`<>'".$this->uid."'"));
					if(CheckRegEmail($_POST['linkmail'])==false){
						$data['msg']='联系邮箱格式错误！';
					}elseif($emailNum>0){
						$data['msg']='联系邮箱已存在！';
					}else{
						$mvalue['email']=$_POST['linkmail'];
					}
				}
				
				if(is_uploaded_file($_FILES['comqcode']['tmp_name'])){
					
 				    $UploadM=$this->MODEL('upload');
				    $upload=$UploadM->Upload_pic(APP_PATH."/data/upload/company/",false);
				    
				    $pictures=$upload->picture($_FILES['comqcode']);
				    
				    $pic=str_replace(APP_PATH."/data/upload/company/","./data/upload/company/",$pictures);
				    $_POST['comqcode']=$pic;
				}
				
				if($_POST['preview']){
					$UploadM =$this->MODEL('upload');
					$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/company/",false);
					$pic     =$upload->imageBase($_POST['preview']);
					$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);
					if($picmsg['status']==$pic){
						$data['msg']=$picmsg['msg'];
	 				}else{
						$_POST['comqcode']=str_replace(APP_PATH."/data/upload/company/","./data/upload/company/",$pic);
						if($company['comqcode']){
							unlink_pic(APP_PATH.$company['comqcode']);
						}
					}
				} 
				
				
				
				unset($_POST['submit']);
				$where['uid']=$this->uid;
				$_POST['lastupdate']=time();
				$_POST['welfare']=@explode(',',$_POST['welfare']);
				foreach($_POST['welfare'] as $v){
					if($v){
						$welfare[]=$v;
					}
				}
				$_POST['welfare']=@implode(',',$welfare);
				if($data['msg']==""){
					/*jam修改更改公司信息中的联系人信息*/
					unset($_POST['welfare']);
					unset($_POST['lastupdate']);

					$nid=$this->obj->update_once("company",$_POST,$where);
					$data['msg']='更新成功！';
					$data['url']='index.php';
				}else{
					$data['msg']=$data['msg'];
				}				
				
			}
			echo json_encode($data);die;
		}
 		/*jam更改调取公司信息为用户表中的信息*/
 		$row=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");

		$this->yunset('row',$row);
		$this->yunset('headertitle',"个人信息");
		$this->get_user();
		$this->waptpl('person_info');
	}

	function getOrder_action(){
		if($_POST){
       		$M=$this->MODEL('compay');
			if($_POST['server']=='autojob'){
 				$return = $M->buyAutoJob($_POST);
				$msg="购买职位自动刷新";
			}elseif ($_POST['server']=='zdjob'){
				$return = $M->buyZdJob($_POST);
				$msg="购买职位置顶";
			}elseif ($_POST['server']=='ujob'){
				$return = $M->buyUrgentJob($_POST);
				$msg="购买紧急招聘";
			}elseif ($_POST['server']=='recjob'){
				$return = $M->buyRecJob($_POST);
				$msg="购买职位推荐";

			}elseif ($_POST['server']=='sxjob'){
				$return = $M->buyRefreshJob($_POST);
				$msg="购买刷新职位";
			}elseif ($_POST['server']=='sxpart'){
				$return = $M->buyRefreshPart($_POST);
				$msg="购买刷新兼职";
			}elseif ($_POST['server']=='issue'){
				$return = $M->buyIssueJob($_POST);
				$msg="购买职位发布";
			}elseif ($_POST['server']=='issuepart'){
				$return = $M->buyIssuePart($_POST);
				$msg="购买兼职发布";
			}elseif ($_POST['server']=='downresume'){
				$return = $M->buyDownresume($_POST);
			}elseif ($_POST['server']=='invite'){
				$return = $M->buyInviteResume($_POST);

			}
			if($return['order']['order_id'] && $return['order']['id']){
				$dingdan = $return['order']['order_id'];
				$price = $return['order']['order_price'];
				$id = $return['order']['id'];

				$this->obj->member_log($msg.",订单ID".$dingdan,88);
				
				$_POST['dingdan']=$dingdan;
				$_POST['dingdanname']=$dingdan;
				$_POST['alimoney']=$price;
				$data['msg']="下单成功，请付款！";
				
				
				if($_POST['paytype']=='alipay'){
					$url=$this->config['sy_weburl'].'/api/wapalipay/alipayto.php?dingdan='.$dingdan.'&dingdanname='.$dingdan.'&alimoney='.$price;
					header('Location: '.$url);exit();
				}
			}else{
				
				if($return['error']){
					$data['msg']=$return['error'];
				}else{
					$data['msg']="提交失败，请重新提交订单！";
				}
				
				$data['url']=$_SERVER['HTTP_REFERER'];
			}
 		}else{
			$data['msg']="参数不正确，请正确填写！";
			$data['url']=$_SERVER['HTTP_REFERER'];
		}
		$this->yunset("layer",$data);
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->get_user();
		$this->waptpl('pay');
	}

	function dkzf_action(){
		if($_POST){
   			$M=$this->MODEL('jfdk');
			if ($_POST['jobautoids']){
				$return = $M->buyAutoJob($_POST);
			}elseif($_POST['zdjobid']){		
				$return = $M->buyZdJob($_POST);
			}elseif ($_POST['recjobid']){
				$return = $M->buyRecJob($_POST);
			}elseif ($_POST['ujobid']){
				$return = $M->buyUrgentJob($_POST);
			}elseif ($_POST['sxjobid']){
				$return = $M->buyRefreshJob($_POST);
			}elseif ($_POST['eid']){
				$return = $M->downresume($_POST);
			}elseif ($_POST['issuejob']){
				$return = $M->buyIssueJob($_POST);
			}elseif ($_POST['issuepart']){
				$return = $M->buyIssuePart($_POST);
			}elseif ($_POST['invite']){
				$return = $M->buyInviteResume($_POST);
			}elseif($_POST['tcid']){
				$return = $M->buyPackOrder($_POST);
			}elseif($_POST['id']){
				$return = $M->buyVip($_POST);
			}elseif ($_POST['sxpartid']){
				$return = $M->buyRefreshPart($_POST);
			}
			if($return['status']==1){
				if($_POST['logid']){
					$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$_POST['logid']."'");
				}
				
				echo json_encode(array('error'=>0,'msg'=>$return['msg']));
			}else{
				if($_POST['logid']){
					$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$_POST['logid']."'");
				}
				
				echo json_encode(array('error'=>1,'msg'=>$return['error'],'url'=>$return['url']));
			}
		}else{
			echo json_encode(array('error'=>1,'msg'=>'参数错误，请重试！'));
		}
	}
	function dingdan_action(){
		$data['msg']="参数不正确，请正确填写！";
		$data['url']=$_SERVER['HTTP_REFERER'];

		if($_POST['price']){			
			$price = $_POST['price'];
			$dingdan=mktime().rand(10000,99999);
			$data['type']='1';
			$data['order_id']=$dingdan;
			$data['order_dkjf']='0';
			$data['order_price']=$price;
			$data['order_time']=mktime();
			$data['order_state']="1";
			$data['order_type']=$_POST['paytype'];
			$data['order_remark']='赏金充值';
			$data['uid']=$this->uid;
			$data['integral']=$_POST['price_int'];

			$id=$this->obj->insert_into("company_job_order",$data);
		
			if($id){
				$this->obj->DB_update_all("user_log","`status`=3,`orderid`='".$dingdan."'","`id`='".$_POST['logid']."'");
				$this->cookie->SetCookie("delay","",time() + 1);

				
				if($_POST['price_int']){
					$this->obj->member_log("充值佣金,订单ID".$dingdan,88);
				}
				
				$data['msg']="下单成功，管理员审核付款！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				/*if($_POST['paytype']=='alipay'){
				    $url=$this->config['sy_weburl'].'/api/wapalipay/alipayto.php?dingdan='.$dingdan.'&dingdanname='.$dingdan.'&alimoney='.$price;
					header('Location: '.$url);exit();
				}*/
			}else{				
				$this->obj->DB_update_all("user_log","`status`=2","`id`='".$_POST['logid']."'");
				$data['msg']="提交失败，请重新提交订单！";
				$data['url']=$_SERVER['HTTP_REFERER'];
			}
		}else{
			$data['msg']="参数不正确，请正确填写！";
			$data['url']=$_SERVER['HTTP_REFERER'];
		}
		$this->yunset("layer",$data);
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->get_user();
		$this->waptpl('pay');
	}
	function paybank_action(){
		
  			if($_POST['bank_name']==""){
				$data['msg']="请填写汇款银行！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				$this->yunset("layer",$data);
			}elseif($_POST['bank_number']==""){
				$data['msg']="请填写汇入账号！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				$this->yunset("layer",$data);
			}elseif($_POST['bank_price']==""){
				$data['msg']="请填写汇款金额！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				$this->yunset("layer",$data);
			}elseif($_POST['bank_time']==""){
				$data['msg']="请填写汇款时间！";
				$data['url']=$_SERVER['HTTP_REFERER'];
				$this->yunset("layer",$data);
			}
			
			$id=intval($_GET['id']);
			$orderbank=$_POST['bank_name'].'@%'.$_POST['bank_number'].'@%'.$_POST['bank_price'];
			if($_POST['bank_time']){
				$banktime=strtotime($_POST['bank_time']);
			}else{
				$banktime="";
			}
			
			if($_POST['preview']){

				
				$UploadM =$this->MODEL('upload');
				$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/order/",false);
				
				$pic     =$upload->imageBase($_POST['preview']);
				
				$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);

				if($picmsg['status']==$pic){
					$data['msg']=$picmsg['msg'];
 				}else{
					$_POST['order_pic']=str_replace(APP_PATH."/data/upload/order/","./data/upload/order/",$pic);
				}
			} 
			
			if($id){
				$order=$this->obj->DB_select_once("company_order","`id`='".$id."' and `uid`='".$this->uid."'");
 				
 				if($order['id']){
				 	$company_order="`order_type`='bank',`order_state`='3',`order_remark`='".$_POST['remark']."',`order_pic`='".$_POST['order_pic']."',`order_bank`='".$orderbank."',`bank_time`='".$banktime."'";

					$this->obj->DB_update_all("company_order",$company_order,"`order_id`='".$order['order_id']."'");
					$data['msg']="操作成功，请等待管理员审核！";
					$data['url']="index.php?c=paylog";
					$this->yunset("layer",$data);
				}else{
					$data['msg']="非法操作！";
					$data['url']=$_SERVER['HTTP_REFERER'];
					$this->yunset("layer",$data);
				}
			}else{
				
				$statis = $this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'","`integral`");
				
				if($_POST['price']){
					if($_POST['comvip']){
						$comvip=(int)$_POST['comvip'];
						
						$ratinginfo =  $this->obj->DB_select_once("company_rating","`id`='".$comvip."'");
						
						$dkjf=(int)$_POST['dkjf'];
						
						if($dkjf >= (int)$statis['integral']){
							$dkjf = $statis['integral'];
						}
						
						if($dkjf){
							$price_ = $dkjf / $this->config['integral_proportion'];
						}else{
							$price_ = 0;
						}
						
						if($ratinginfo['time_start']<time() && $ratinginfo['time_end']>time()){
							$price = $ratinginfo['yh_price'] - $price_ ;
						}else{
							$price = $ratinginfo['service_price'] - $price_;
						}
						 
						$data['type']='1';
					}elseif($_POST['comservice']){

						$id=(int)$_POST['comservice'];
				
						$dkjf=(int)$_POST['dkjf'];
						
						if($dkjf >= (int)$statis['integral']){
							$dkjf = (int)$statis['integral'];
						}
						
						if($dkjf){
							$price_ = $dkjf / $this->config['integral_proportion'];
						}else{
							$price_ = 0;
						}
						
						$price=$_POST['price'] - $price_ ;
		
						$data['type']='5';
								
					}elseif($_POST['price_int']){
					    if($this->config['integral_min_recharge'] && $_POST['price_int']<$this->config['integral_min_recharge']){
					        $data['msg']="充值不得低于".$this->config['integral_min_recharge'];
					        $data['url']=$_SERVER['HTTP_REFERER'];
					        $this->yunset("layer",$data);
					        $this->waptpl('pay');exit;
					    }
					    $integralid=intval($_POST['integralid']);
					    $CacheMclass=$this->MODEL('cache')->GetCache(array('integralclass'));
					    $discount=$CacheMclass['integralclass_discount'][$integralid]/100;
					    if($integralid&&$discount>0){
					        $price =  $_POST['price_int']/$this->config['integral_proportion']*$discount;
					    }else{
					        $price = $_POST['price_int']/$this->config['integral_proportion'];
					    }
					    $price=floor($price*100)/100;

					    $data['type']='2';
					}
					$dingdan=mktime().rand(10000,99999);
					$data['order_id']=$dingdan;
					$data['order_dkjf']=$dkjf;
					$data['order_price']=$price;
					$data['order_time']=mktime();
					$data['order_state']="3";
					$data['order_type']="bank";
					$data['order_remark']=trim($_POST['remark']);
					$data['order_pic']=$_POST['order_pic'];
					$data['order_bank']=$orderbank;
					$data['bank_time']=$banktime;
					$data['uid']=$this->uid;
					$data['rating']=$_POST['comvip']?$_POST['comvip']:$_POST['comservice'];
					$data['integral']=$_POST['price_int'];
					
					
					$id=$this->obj->insert_into("company_order",$data);
					if($id){
						if($_POST['comservice']){
							$this->MODEL('integral')->company_invtal($this->uid,$dkjf,false,"购买增值包",true,2,'integral',11);
							$this->obj->member_log("购买增值服务,订单ID".$dingdan,88);
						}else if($_POST['comvip']){
							$this->MODEL('integral')->company_invtal($this->uid,$dkjf,false,"购买会员",true,2,'integral',27);
							$this->obj->member_log("购买会员,订单ID".$dingdan,88);
						}else if($_POST['price_int']){
							$this->obj->member_log("充值积分,订单ID".$dingdan,88);
						}
						
						$this->obj->DB_update_all("user_log","`status`=3,`orderid`='".$dingdan."'","`id`='".$_POST['logid']."'");
						$this->cookie->SetCookie("delay","",time() + 1);

						$data['msg']="操作成功，请等待管理员审核！";
						$data['url']="index.php?c=paylog";
						$this->yunset("layer",$data);
					}else{
						$this->obj->DB_update_all("user_log","`status`=2","`id`='".$_POST['logid']."'");
						$data['msg']="提交失败，请重新提交订单！";
						$data['url']=$_SERVER['HTTP_REFERER'];
					}
				}else{
					$data['msg']="参数不正确，请正确填写！";
					$data['url']=$_SERVER['HTTP_REFERER'];
				}
			}
		
			$this->yunset("layer",$data);
			
			$backurl=Url('wap',array(),'member');
			$this->yunset('backurl',$backurl);
			$this->get_user();
			$this->waptpl('payment');
	}
	function look_job_action(){
		$urlarr['c']='look_job';
		$urlarr["page"]="{{page}}";
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("look_job","`com_id`='".$this->uid."' and `com_status`='0' order by datetime desc",$pageurl,"10");
		if(is_array($rows))
		{
			foreach($rows as $v)
			{
				$uid[]=$v['uid'];
				$jobid[]=$v['jobid'];
			}
			$cjob=$this->obj->DB_select_all("company_job","`id`in(".@implode(',',$jobid).")","`name`,`id`");
			$resume=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).")","`uid`,`name`,`edu`,`exp`,`sex`,`def_job` as `eid`");
			$userid_msg=$this->obj->DB_select_all("userid_msg","`fid`='".$this->uid."' and `uid` in (".pylode(",",$uid).")","uid");
			include(PLUS_PATH."user.cache.php");
			include(PLUS_PATH."job.cache.php");
			include(CONFIG_PATH."db.data.php");
			unset($arr_data['sex'][3]);
			$this->yunset("arr_data",$arr_data);
			foreach($resume as $val){
				$eid[]=$val['eid'];
			}
			$expect=$this->obj->DB_select_all("resume_expect","`id` in (".pylode(",",$eid).")","`id`,`uid`,`salary`,job_classid");
			foreach($rows as $key=>$val)
			{
				foreach($expect as $v){
					if($val['uid']==$v['uid']){
						$rows[$key]['resume_id']=$v['id'];
						$rows[$key]['salary']=$userclass_name[$v['salary']];
						if($v['job_classid']!=""){
							$job_classid=@explode(",",$v['job_classid']);
							$rows[$key]['jobname']=$job_name[$job_classid[0]];
						}
					}
				}
				foreach($resume as $va)
				{
					if($val['uid']==$va['uid'])
					{
						$rows[$key]['sex']=$arr_data['sex'][$va['sex']];
						$rows[$key]['exp']=$userclass_name[$va['exp']];
						$rows[$key]['edu']=$userclass_name[$va['edu']];
						$rows[$key]['name']=$va['name'];
					}
				}
				foreach($userid_msg as $va)
				{
					if($val['uid']==$va['uid'])
					{
						$rows[$key]['userid_msg']=1;
					}
				}
				foreach($cjob as $va)
				{
					if($val['jobid']==$va['id'])
					{
						$rows[$key]['comjob']=$va['name'];
					}
				}
			}
		}
		$this->yunset("rows",$rows);
		$this->yunset("js_def",5);
		$backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"谁看过我");
		$this->get_user();
		$this->waptpl('look_job');
	}
	function lookresumedel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_update_all("look_resume","`com_status`='1'","`id`='".(int)$_GET['id']."' and `com_id`='".$this->uid."'");
			if($nid){
			    $this->obj->member_log("删除已浏览简历记录（ID:".(int)$_GET['id']."）",26,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}
	function lookjobdel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_update_all("look_job","`com_status`='1'","`id`='".(int)$_GET['id']."' and `com_id`='".$this->uid."'");
			if($nid){
			    $this->obj->member_log("删除已浏览简历记录（ID:".(int)$_GET['id']."）",26,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}

	function look_resume_action(){
		$urlarr['c']='look_resume';
		$urlarr["page"]="{{page}}";
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("look_resume","`com_id`='".$this->uid."' and `com_status`='0' order by datetime desc",$pageurl,"10");
		if(is_array($rows)){
			foreach($rows as $v){
				$resume_id[]=$v['resume_id'];
				$uid[]=$v['uid'];
			}
			$resume=$this->obj->DB_select_alls("resume","resume_expect","a.uid=b.uid and b.`id` in (".pylode(",",$resume_id).")","a.`name`,a.`sex`,a.`exp`,a.`edu`,a.`birthday`,b.`id`,b.job_classid,b.`salary`");
			$userid_msg=$this->obj->DB_select_all("userid_msg","`fid`='".$this->uid."' and `uid` in (".pylode(",",$uid).")","uid");
			if(is_array($resume)){
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				$age=date("Y",time());
				$time=date("Y",0);
				foreach($rows as $key=>$val){
					foreach($resume as $va){
						if($val['resume_id']==$va['id']){
							$rows[$key]['name']=$va['name'];
							$rows[$key]['salary']=$userclass_name[$va['salary']];
							$rows[$key]['birthday']=$va['birthday'];
							$rows[$key]['sex']=$arr_data['sex'][$va['sex']];
							$rows[$key]['exp']=$userclass_name[$va['exp']];
							$rows[$key]['edu']=$userclass_name[$va['edu']];
							if($va['job_classid']!=""){
								$job_classid=@explode(",",$va['job_classid']);
								$rows[$key]['jobname']=$job_name[$job_classid[0]];
							}
						}
					}
					foreach($userid_msg as $va){
						if($va['uid']&&$val['uid']&&$val['uid']==$va['uid']){
							$rows[$key]['userid_msg']=1;
						}
					}
				}
			}
		}
		$this->yunset("age",$age);
		$this->yunset("time",$time);
		$this->yunset("rows",$rows);
		$this->yunset("js_def",5);
		$backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"浏览简历");
		$this->get_user();
		$this->waptpl('look_resume');
	}
	

	function talent_pool_remark_action()
	{
		if($_POST['remark']=="")
		{
			$this->ACT_layer_msg("备注内容不能为空！",8,$_SERVER['HTTP_REFERER']);
		}else{
			$nid=$this->obj->DB_update_all("talent_pool","`remark`='".$_POST['remark']."'","`id`='".(int)$_POST['id']."' and `cuid`='".$this->uid."'");
			if($nid){

			    $this->obj->member_log("收藏人才备注".$_POST['r_name'],5,1);
				
				$data['msg']="备注成功！";
				$data['url']=$this->config['sy_weburl'].'/wap/member/index.php?c=talent_pool';
			}else{
				
				$data['msg']="备注失败！";
				$data['url']=$this->config['sy_weburl'].'/wap/member/index.php?c=talent_pool';
			}
		}
		$this->yunset("layer",$data);
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		
		$this->get_user();
		$this->waptpl('talent_pool');
	}
	function talentpooldel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_delete_all("talent_pool","`id`='".(int)$_GET['id']."' and `cuid`='".$this->uid."'");
			if($nid){
			    $this->obj->member_log("删除收藏简历人才（ID:".(int)$_GET['id']."）",5,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}
	function talent_pool_action(){
		$where="`cuid`='".$this->uid."'";
		$urlarr['c']='talent_pool';
		$urlarr["page"]="{{page}}";
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("talent_pool",$where."  order by id desc",$pageurl,"10");
		if(is_array($rows)) {
			foreach($rows as $v) {
				$uid[]=$v['uid'];
				$eid[]=$v['eid'];
			}
			$resume=$this->obj->DB_select_alls("resume","resume_expect","a.uid=b.uid and a.`r_status`<>'2' and a.uid in (".pylode(',',$uid).")","a.`name`,a.`uid`,a.`sex`,a.`birthday`,b.`edu`,a.`exp`,b.`job_classid`,b.id as eid,b.salary");
			$user=$this->obj->DB_select_all("resume","`birthday`limit 2");

			$userid_msg=$this->obj->DB_select_all("userid_msg","`fid`='".$this->uid."' and `uid` in (".pylode(",",$uid).")","uid");
			if(is_array($resume)) {
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				$age=date("Y",time());
				$time=date("Y",0);
				foreach($rows as $key=>$val) {
					foreach($resume as $va) {
						if($val['uid']==$va['uid'])
						{
							$rows[$key]['birthday']=$va['birthday'];
							$rows[$key]['eid']=$va['eid'];
							$rows[$key]['name']=$va['name'];
							$rows[$key]['sex']=$arr_data['sex'][$va['sex']];
							$rows[$key]['exp']=$userclass_name[$va['exp']];
							$rows[$key]['edu']=$userclass_name[$va['edu']];
							if($va['job_classid']!="")
							{
								$job_classid=@explode(",",$va['job_classid']);
								$rows[$key]['jobname']=$job_name[$job_classid[0]];
							}
						}
					}
					foreach($user as $value){
						if($val['uid']==$value['uid']){
							$rows[$key]['age']=$user['age'];
						}
					}
					foreach($userid_msg as $va)
					{
						if($val['uid']==$va['uid'])
						{
							$rows[$key]['userid_msg']=1;
						}
					}
				}
			}
		}
		$this->yunset("age",$age);
		$this->yunset("time",$time);
		$this->yunset("rows",$rows);
		$this->company_satic();
		$this->yunset("js_def",5);
		if($_GET['type']){
			$backurl=Url('wap',array(),'member');
		}else{
			$backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		}
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"收藏人才");
		$this->get_user();
		$this->waptpl('talent_pool');
	}
	function invite_action(){
		// $urlarr['c']='invite';
		// $urlarr["page"]="{{page}}";
		// $pageurl=Url('wap',$urlarr,'member');
		// $rows=$this->get_page("userid_msg"," `fid`='".$this->uid."' order by id desc",$pageurl,"10");
		// if(is_array($rows) && !empty($rows)){
		// 	foreach($rows as $v){
		// 		$uid[]=$v['uid'];
		// 	}
		// 	$resume=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).") and `r_status`<>'2'","`uid`,`name`,`exp`,`sex`,`telphone`,`resume_photo`,`edu`,`def_job` as `eid`");
		// 	foreach($resume as $val){
		// 		$eid[]=$val['eid'];
		// 	}
		// 	$expect=$this->obj->DB_select_all("resume_expect","`id` in (".pylode(",",$eid).")","`salary`,`id`,`job_classid`");
		// 	if(is_array($resume)){
		// 		$user=array();
		// 		include(PLUS_PATH."user.cache.php");
		// 		include(PLUS_PATH."job.cache.php");
		// 		include(CONFIG_PATH."db.data.php");
		// 		unset($arr_data['sex'][3]);
		// 		$this->yunset("arr_data",$arr_data);
		// 		foreach($rows as $k=>$v){
		// 			/*投递简历记录表的中的id*/
		// 			$tj = $this->obj->DB_select_once("userid_job","`uid`='".$v['uid']."' and `job_id`='".$v['jobid']."'" ,"`id`,`is_browse`");
			
		// 			foreach($resume as $val){
		// 				foreach($expect as $v){
		// 					if($v['id']==$val['eid']){
		// 						$user[$val['uid']]['salary']=$userclass_name[$v['salary']];
		// 						if($v['job_classid']!=""){
		// 							$job_classid=@explode(",",$v['job_classid']);
		// 							$user[$val['uid']]['jobname']=$job_name[$job_classid[0]];
		// 						}
		// 					}
		// 				}

		// 				$rows[$k]['eid']=$val['eid'];
		// 				$rows[$k]['name']=mb_substr($val['name'],0,8);
		// 				$rows[$k]['exp']=$userclass_name[$val['exp']];
		// 				$rows[$k]['edu']=$userclass_name[$val['edu']];
		// 				$rows[$k]['sex']=$arr_data['sex'][$val['sex']];
		// 				$rows[$k]['telphone']=$val['telphone'];
		// 				$rows[$k]['resume_photo']=$this->config['sy_weburl'].'/'.trim($val['resume_photo'],'.');/*用户头像*/


		// 			}
					
		// 			$rows[$k]['tjl_id'] = $tj['id'];
		// 			$rows[$k]['com_is_browse'] = $tj['is_browse'];
		// 			if($_GET['type']=='done'){
		// 				if($tj['is_browse'] < 6 || $tj['is_browse']==7){
							
		// 					unset($rows[$k]);
		// 				}
		// 			}else{
		// 				if($tj['is_browse'] >=5){
		// 					unset($rows[$k]);
		// 				}
		// 			}
		// 		}
		// 	}
		// 	$this->yunset("user",$user);
		// }
		// foreach ($rows as $key => $value) {
		// 	/*jam判断该企业是否已评价过该用户*/
		// 	$comment = $this->obj->DB_select_once("comments","`uid`='".$value['uid']."' " );
		// 	if(empty($comment)){
		// 		/*未评价*/
		// 		$rows[$key]['comment'] = 1;
		// 	}
		// }
		if($_GET['type']=='done'){
			$this->yunset('header_title',"已完成");
			
		}else{
			$this->yunset('header_title',"待确认");
		}
		// print_r($header_title);die("aaa");
		// $this->yunset("rows",$rows);
		$this->yunset("js_def",5);
		// $backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		// $this->yunset('backurl',$backurl);
		
		$this->get_user();
		$this->waptpl('invite');
	}
	function inviteajax_action(){
		 $page = $_POST['page'];
	      $pagesize=5;
	      $offset = ($page-1)*$pagesize;
		
		// $rows=$this->obj->DB_select_all("userid_msg"," `fid`='".$this->uid."' order by id desc limit ". $offset. ",". $pagesize);
	     $rows = array();

	    if($_POST['state']=='done'){
			
				$SQL = "SELECT um.*,uj.id as tjl_id,uj.is_browse as com_is_browse FROM phpyun_userid_msg as um left join phpyun_userid_job as uj on uj.`uid` = um.`uid` and uj.`job_id`=um.`jobid` WHERE um.`fid`='".$this->uid."'  and uj.`is_browse` >= 6 and uj.`is_browse` != 7  order by um.id desc limit ". $offset. ",". $pagesize;
			
		}else{
			
				$SQL = "SELECT um.*,uj.id as tjl_id,uj.is_browse as com_is_browse FROM phpyun_userid_msg as um left join phpyun_userid_job as uj on uj.`uid` = um.`uid` and uj.`job_id`=um.`jobid` WHERE um.`fid`='".$this->uid."' and uj.`is_browse`<5  order by um.id desc limit ". $offset. ",". $pagesize; 
			
		}

		
		$query=$this->db->query($SQL);
		while($data = $this->db->fetch_array($query)) {
 				$rows[] = $data;
		}
		
		if(is_array($rows) && !empty($rows)){
			foreach($rows as $v){
				$uid[]=$v['uid'];
			}
			$resume=$this->obj->DB_select_all("resume","`uid` in (".pylode(",",$uid).") and `r_status`<>'2'","`uid`,`name`,`exp`,`sex`,`telphone`,`resume_photo`,`birthday`,`edu`,`def_job` as `eid`");
			foreach($resume as $val){
				$eid[]=$val['eid'];
			}
			$expect=$this->obj->DB_select_all("resume_expect","`id` in (".pylode(",",$eid).")","`salary`,`id`,`job_classid`");
			if(is_array($resume)){
				$user=array();
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				foreach($rows as $k=>$v){
					/*投递简历记录表的中的id*/
					$tj = $this->obj->DB_select_once("userid_job","`uid`='".$v['uid']."' and `job_id`='".$v['jobid']."'" ,"`id`,`is_browse`");

					$rows[$k]['datetime']=date('Y-m-d H:i:s',$v['datetime']);
			// print_r($v);
			// print_r($rows[$k]['datetime']);
					foreach($resume as $val){
						foreach($expect as $v){
							if($v['id']==$val['eid']){
								if($val['birthday']){
								    $a=date('Y',strtotime($val['birthday']));
								    $rows[$k]['age']=date("Y")-$a;
								}else{
									$rows[$k]['age']='无';
								}
								$user[$val['uid']]['salary']=$userclass_name[$v['salary']];
								if($v['job_classid']!=""){
									$job_classid=@explode(",",$v['job_classid']);
									$user[$val['uid']]['jobname']=$job_name[$job_classid[0]];
								}
							}
						}
						
						$rows[$k]['eid']=$val['eid'];
						$rows[$k]['name']=mb_substr($val['name'],0,8);
						$rows[$k]['exp']=$userclass_name[$val['exp']];
						$rows[$k]['edu']=$userclass_name[$val['edu']];
						$rows[$k]['sex']=$arr_data['sex'][$val['sex']];
						$rows[$k]['telphone']=$val['telphone'];
						$rows[$k]['resume_photo']=$this->config['sy_weburl'].'/'.trim($val['resume_photo'],'.');/*用户头像*/


					}
					// print_r($v);
					
					// $rows[$k]['tjl_id'] = $tj['id'];
					// $rows[$k]['com_is_browse'] = $tj['is_browse'];
					// if($_GET['type']=='done'){
					// 	if($tj['is_browse'] < 6 || $tj['is_browse']==7){
							
					// 		unset($rows[$k]);
					// 	}
					// }else{
					// 	if($tj['is_browse'] >=5){
					// 		unset($rows[$k]);
					// 	}
					// }
				}
			}
			// $this->yunset("user",$user);
		}
		foreach ($rows as $key => $value) {
			/*jam判断该企业是否已评价过该用户*/
			$comment = $this->obj->DB_select_once("comments","`uid`='".$value['uid']."' " );
			if(empty($comment)){
				/*未评价*/
				$rows[$key]['comment'] = 1;
			}
		}
		// print_r($rows);
		echo json_encode($rows);die;
	}
	/*jam添加面试后不合适操作*/
	function bhs_action(){
		/*7不合适*/
		$nid =$this->obj->DB_update_all("userid_job","`is_browse`='".$_GET['type']."'","`id`='".$_GET['id']."'");
		if($nid){
			$data['msg']="操作成功";
			$data['url']=1;
		}else{
			$data['msg']="操作失败";
			$data['url']=1;
		}
		
		echo json_encode($data);die;
	}

	/*jam添加面试后未到岗和确认入职操作*/
	function faceok_action(){
		/*8未到岗，9确认已到岗*/
		$nid =$this->obj->DB_update_all("userid_job","`is_browse`='".$_GET['type']."'","`id`='".$_GET['id']."'");
		$infos =$this->obj->DB_select_once("userid_job","`id`='".$_GET['id']."'","`uid`,`job_name`");
		if($_GET['type'] == 9){
			/*插入工作履历表*/
			$data=array();
			$data['uid'] = $infos['uid'];
			$data['jobname'] = $infos['job_name'];
			$data['addtime'] = time();
			$nid=$this->obj->insert_into("work_log",$data);
			
			/*分红*/

		}
		if($nid){
			$data['msg']="操作成功";
			$data['url']=1;
		}else{
			$data['msg']="操作失败";
			$data['url']=1;
		}
		
		echo json_encode($data);die;
	}
	/*jam添加面试后对用户进行评价s*/
	function comments_action(){
		include PLUS_PATH."/com.cache.php";
		$jam_label = $comdata['com_comments'];
		$new =array();
		foreach ($comclass_name as $key => $value) {
			if(in_array($key, $jam_label)){
				$new[$key]=$value;
			}
		}
		$this->yunset('new',$new);
		if(empty($_GET['id']) || empty($_GET['jobid']) || empty($_GET['uid'])){
			$this->yunset('error','信息有误');
		}else{
			$job = $this->obj->DB_select_once("company_job","`id`='".$_GET["jobid"]."'","`name`,`com_name`");

			$this->yunset('job',$job);
			$this->yunset('com_id',$_GET['id']);
			$this->yunset('job_id',$_GET['jobid']);
			$this->yunset('uid',$_GET['uid']);
		}
		/*提交评价*/
		if($_POST){	
			$return = '';
			if(empty($_POST['job_id']) || empty($_POST['com_id'])){
				$return  = 1;/*信息有误*/
			}elseif(empty($_POST['zh_lv']) || empty($_POST['comment_desc']) ){
				$return  = 2;/*评价内容不完整*/
			}else{
				$comment = $this->obj->DB_select_once("comments","`uid`='".$_POST['uid']."' " );
				if($comment){
					$return = 8;
				}else{
					$job = $this->obj->DB_select_once("company_job","`id`='".$_POST["job_id"]."'","`name`");
					$data=array();
					$data['uid'] = $_POST['uid'];
					$data['com_id'] = $_POST['com_id'];
					$data['zh_lv'] = $_POST['zh_lv'];
					$data['comment_desc'] = $_POST['comment_desc'];
					$data['jobid'] = $_POST['job_id'];
					$data['addtime'] = time();
					$data['jobname'] = $job['name'];
					$data['labels'] = $_POST['arr'];
					$data['type'] = 2;
					unset($_POST);
					$nid=$this->obj->insert_into("comments",$data);

					if($nid){
						$return = 6;/*评价成功*/
					}else{
						$return =4;/*评价失败*/
					}
				}
			}
			echo $return;die();
		}
		$this->yunset('headertitle',"评价");
		$this->waptpl('comments_user');
	}
	function invite_del_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_delete_all("userid_msg","`id`='".(int)$_GET['id']."' and `fid`='".$this->uid."'");
			if($nid){
			    $this->obj->member_log("删除已邀请面试的人才",4,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}
	function part_action(){
		$this->rightinfo();
		$urlarr=array("c"=>"part","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("partjob","`uid`='".$this->uid."'",$pageurl,"10");
		if(is_array($rows)){
			foreach($rows as $k=>$v){
				$rows[$k]['applynum']=$this->obj->DB_select_num("part_apply","`jobid`='".$v['id']."'");
			}
		}
		$this->company_satic();
		$this->yunset("rows",$rows);
		$backurl=Url('wap',array('c'=>'jobcolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"兼职管理");
		$this->get_user();
		$this->waptpl('part');
	}
	function partadd_action(){
		include(CONFIG_PATH."db.data.php");
		$this->yunset("arr_data",$arr_data);
		$statics=$this->company_satic();
		if($_GET['id']){
			$row=$this->obj->DB_select_once("partjob","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."'");
			$row['work']=$row['worktime'];
			$row['worktime']=explode(',', $row['worktime']);
			$arr_data1=$arr_data['sex'][$row['sex']];
			$this->yunset("arr_data1",$arr_data1);
			$row['content_t']=strip_tags($row['content']);
			$this->yunset("row",$row);
		}else{
			if($statics['addpartjobnum']==0){ 
				$data['msg']="您的会员已到期！";
				$data['url']='index.php?c=rating';
			}
			if($statics['addpartjobnum']==2){ 
				if($this->config['integral_partjob']!='0'){
					$data['msg']="您的套餐已用完！";
					$data['url']='index.php?c=rating';
				}else{
					$this->obj->DB_update_all("company_statis","`part_num` = '1'","`uid`='".$this->uid."'");
				}
			}
		}


		if($_POST['submit']){

 			$_POST['content']=str_replace(array("&amp;","background-color:#ffffff","background-color:#fff","white-space:nowrap;"),array("&",'background-color:','background-color:','white-space:'),$_POST['content']);
			$_POST['sdate']=strtotime($_POST['sdate']);
			
			if($_POST['timetype']!='1'){
				$_POST['edate']="";
				$_POST['deadline']="";
			}else{
				$_POST['edate']=strtotime($_POST['edate']);
				$_POST['deadline']=strtotime($_POST['deadline']);
			}
			$_POST['state'] = $this->config['com_partjob_status'];
			$id=(int)$_POST['id'];
			$logid=(int)$_POST['logid'];
			unset($_POST['submit']);
			unset($_POST['id']);
			unset($_POST['logid']);

			if(!$id){
				$_POST['addtime'] = time();
				$_POST['uid'] = $this->uid;
				$_POST['lastupdate'] = time();
				$data['msg']=$this->get_com(7);
				if($data['msg']==''){
					$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
					$_POST['com_name']=$company['name'];

					
					if(!isset($_POST['state']) || ($_POST['state'] != 0 && $this->usertype == 2)){
						$member = $this->obj->DB_select_once("member", "`uid`='{$this->uid}'", "`status`");
						if($member['status'] != 1){
							$_POST['state'] = 0;
						}
					}

					$nid=$this->obj->insert_into("partjob",$_POST);
					$name="添加兼职职位";
					if($nid){
						$state_content = "新发布了兼职职位 <a href=\"".$this->config['sy_weburl']."/part/index.php?c=show&id=$nid\" target=\"_blank\">".$_POST['name']."</a>。";
						$this->addstate($state_content,2);
						$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$logid."'");
						$data['msg']=$name."成功！";
					}else{
						$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$logid."'");
						$data['msg']=$name."失败！";
					}
				}
			}else{
				$job=$this->obj->DB_select_once("partjob","`id`='".$id."' and `uid`='".$this->uid."'","state");
				if($job['state']=="1" || $job['state']=="2"){
					$data['msg']="";
				}
				if($data['msg']==''){
					$where['id']=$id;
					$where['uid']=$this->uid;
					$nid=$this->obj->update_once("partjob",$_POST,$where);
					$name="更新兼职职位";
					if($nid){
						$this->obj->DB_update_all("user_log","`status`='1'","`id`='".$logid."'");
						$data['msg']=$name."成功！";
					}else{
						$this->obj->DB_update_all("user_log","`status`='2'","`id`='".$logid."'");
						$data['msg']=$name."失败！";
					}
				}
			}
			$data['url']='index.php?c=part';
			echo json_encode($data);die;
		}
		$this->rightinfo();
		$this->yunset("layer",$data);
		$this->yunset($this->MODEL('cache')->GetCache(array('city','part')));
		$morning=array('0101','0201','0301','0401','0501','0601','0701');
		$noon=array('0102','0202','0302','0402','0502','0602','0702');
		$afternoon=array('0103','0203','0303','0403','0503','0603','0703');
		$this->yunset(array('morning'=>$morning,'noon'=>$noon,'afternoon'=>$afternoon));
		$this->yunset("today",date("Y-m-d"));
		$this->yunset('header_title',"发布兼职");
		$this->get_user();
		$this->waptpl('partadd');
	}
	function partdel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_delete_all("partjob","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'");
			if($nid){
				$this->obj->DB_delete_all("part_collect","`jobid`='".(int)$_GET['id']."'","");
				$this->obj->DB_delete_all("part_apply","`jobid`='".(int)$_GET['id']."'","");
				$this->obj->member_log("删除兼职",9,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}
	function photo_action(){
		if($_POST['submit']){
 			$pic=$this->wap_up_pic($_POST['uimage'],'company');
			if($pic['errormsg']){echo 4;die;}
			if($pic['re']){
				$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`logo`");
				if(!$company['logo']){
					$this->MODEL('integral')->get_integral_action($this->uid,"integral_avatar","上传LOGO");
				}
				unlink_pic(APP_PATH.$company['logo']);
				$photo="./data/upload/company/".date('Ymd')."/".$pic['new_file'];
				if($this->config['com_logo_status']=='1'){
					$this->obj->DB_update_all("company","`logo`='".$photo."',`logo_status`='1'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company_job","`com_logo`=''","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("answer","`pic`=''","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("question","`pic`=''","`uid`='".$this->uid."'");
					echo 3;die;
				}else{
					$this->obj->DB_update_all("company","`logo`='".$photo."',`logo_status`='0'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company_job","`com_logo`='".$photo."'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("answer","`pic`='".$photo."'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("question","`pic`='".$photo."'","`uid`='".$this->uid."'");
					echo 1;die;
				}
				
			}else{
				unlink_pic(APP_PATH."data/upload/company/".date('Ymd')."/".$pic['new_file']);
				echo 2;die;
			}
		}else{
			$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`logo`");
			
			if(!$company['logo'] || !file_exists(str_replace('./',APP_PATH,$company['logo']))){
				$company['logo']=$this->config['sy_weburl']."/".$this->config['sy_unit_icon'];
			}else{
				$company['logo']="";
			}
			$this->yunset("company",$company);
			if($_GET['t']){
				$backurl=Url('wap',array(),'member');
			}else if($_GET['type']){
				$backurl=Url('wap',array('c'=>'integral'),'member');
			}else{
				$backurl=Url('wap',array('c'=>'info'),'member');
			}
			$this->yunset('backurl',$backurl);
			
			$this->yunset('header_title',"企业LOGO");
			
			$this->get_user();
			$this->waptpl('photo');
		}
	}
	/*jam添加上传企业联系人头像*/
	function photo2_action(){
		if($_POST['submit']){
 			$pic=$this->wap_up_pic($_POST['uimage'],'company');
			if($pic['errormsg']){echo 4;die;}
			if($pic['re']){
				$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`link_head_img`");
				if(!$company['link_head_img']){
					$this->MODEL('integral')->get_integral_action($this->uid,"integral_avatar","上传头像");
				}
				unlink_pic(APP_PATH.$company['link_head_img']);
				$photo="./data/upload/company/".date('Ymd')."/".$pic['new_file'];
				// if($this->config['com_logo_status']=='1'){
				// 	$this->obj->DB_update_all("company","`link_head_img`='".$photo."',`logo_status`='1'","`uid`='".$this->uid."'");
				// 	// $this->obj->DB_update_all("company_job","`com_logo`=''","`uid`='".$this->uid."'");
				// 	// $this->obj->DB_update_all("answer","`pic`=''","`uid`='".$this->uid."'");
				// 	// $this->obj->DB_update_all("question","`pic`=''","`uid`='".$this->uid."'");
				// 	// echo 3;die;
				// }else{
					$this->obj->DB_update_all("company","`link_head_img`='".$photo."',`logo_status`='0'","`uid`='".$this->uid."'");
					// $this->obj->DB_update_all("company_job","`com_logo`='".$photo."'","`uid`='".$this->uid."'");
					// $this->obj->DB_update_all("answer","`pic`='".$photo."'","`uid`='".$this->uid."'");
					// $this->obj->DB_update_all("question","`pic`='".$photo."'","`uid`='".$this->uid."'");
					echo 1;die;
				// }
				
			}else{
				unlink_pic(APP_PATH."data/upload/company/".date('Ymd')."/".$pic['new_file']);
				echo 2;die;
			}
		}else{
			$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`link_head_img`");
			
			if(!$company['link_head_img'] || !file_exists(str_replace('./',APP_PATH,$company['link_head_img']))){
				$company['link_head_img']=$this->config['sy_weburl']."/".$this->config['sy_unit_icon'];
			}else{
				$company['link_head_img']="";
			}
			$this->yunset("company",$company);
			if($_GET['t']){
				$backurl=Url('wap',array(),'member');
			}else if($_GET['type']){
				$backurl=Url('wap',array('c'=>'integral'),'member');
			}else{
				$backurl=Url('wap',array('c'=>'info'),'member');
			}
			$this->yunset('backurl',$backurl);
			
			$this->yunset('header_title',"用户头像");
			
			$this->get_user();
			$this->waptpl('photo');
		}
	}

	function comcert_action(){
		if($_POST['submit']){
			
			$comname=$this->obj->DB_select_num('company',"`uid`<>'".$this->uid."' and `name`='".$_POST['name']."'","`uid`");
            $row=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."' and type='3'");
            if($_POST['name']==""){
				$data['msg']='企业全称不能为空！';
			}elseif($comname){
				$data['msg']='企业全称已存在！';
			}elseif(empty($_POST['address'])){
				$data['msg']='请填写企业地址';
			}elseif(!$_POST['preview']&&!$row['check']){
				$data['msg']='请上传营业执照！';
			}else{
				if($_POST['preview']){
					
					$UploadM =$this->MODEL('upload');
					$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/cert/",false);
					
					$pic     =$upload->imageBase($_POST['preview']);
					
					$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);

					if($picmsg['status']==$pic){
						$data['msg']=$picmsg['msg'];
 					}else{
						
						$photo=str_replace(APP_PATH."/data/upload/cert/","./data/upload/cert/",$pic);
						if($row['check']){
							unlink_pic(APP_PATH.$row['check']);
						}
					}
				}else{
					$photo=$row['check'];
				}
			}
			if($data['msg']==""){
				if($this->config['com_cert_status']=="1"){
					$sql['status']=0;
				}else{
					$sql['status']=1;
				}
				$this->obj->DB_update_all("company","`name`='".$_POST['name']."',`yyzz_status`='".$sql['status']."',`address`='".$_POST['address']."' ","`uid`='".$this->uid."'");

				/*jam更新企业的企业职务s*/
				$this->obj->DB_update_all("member","`hy`='".$_POST['hy']."' ","`uid`='".$this->uid."'");
				/*jam更新企业的企业职务e*/
				$sql['step']=1;
				$sql['check']=$photo;
				$sql['check2']="0";
				$sql['ctime']=mktime();
				$company=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."'  and type='3'","`check`");
				if(is_array($company)){
					$where['uid']=$this->uid;
					$where['type']='3';
					$this->obj->update_once("company_cert",$sql,$where);
					$this->obj->member_log("更新营业执照",13,2);
				}else{
					$sql['uid']=$this->uid;
					$sql['did']=$this->userdid;
					$sql['type']=3;
					$this->obj->insert_into("company_cert",$sql);
					$this->obj->member_log("上传营业执照",13,1);
					if($this->config['com_cert_status']!="1"){
						$this->MODEL('integral')->get_integral_action($this->uid,"integral_comcert","认证营业执照");
					}
				}
				$this->obj->DB_update_all("user_log","`status`='13'","`id`='".$_POST['logid']."'");

				$data['msg']='上传营业执照成功！';
				$data['url']='index.php?c=set';
			}else{
				$data['msg']=$data['msg'];
				$data['url']='index.php?c=comcert';
			}
		}
		$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`name`,`address`");
		$cert=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."' and `type`='3'");
		$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."' ");
		if($cert['check']){
		    $cert['old_check']=str_replace('./data','/data',$cert['check']);
		}
		$this->yunset("company",$company);
		$this->yunset("cert",$cert);
		$this->yunset("layer",$data);
		$this->yunset("member",$member);
		/*jam添加公司地址列表*/
		include PLUS_PATH."/city.cache.php";
		$this->yunset('city_name',$city_name);

		$this->yunset('header_title',"我的公司");
		$this->get_user();
		$this->waptpl('comcert');
	}

	function binding_action(){
		if($_POST['moblie']){
			$row=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."' and `check`='".$_POST['moblie']."'");
			if(!empty($row)){
				session_start();
				if($row['check2']!=$_POST['code']){
					echo 3;die;
				}else if(!$_POST['authcode']){
					echo 4;die;
				}elseif(md5(strtolower($_POST['authcode']))!=$_SESSION['authcode'] || empty($_SESSION['authcode'])){
					echo 5;die;
				}else{
					
					$this->obj->DB_update_all("resume","`moblie_status`='0'","`telphone`='".$row['check']."'");
					$this->obj->DB_update_all("company","`moblie_status`='0'","`linktel`='".$row['check']."'");
					$this->obj->DB_update_all("member","`moblie`='".$row['check']."'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company","`linktel`='".$row['check']."',`moblie_status`='1'","`uid`='".$this->uid."'");
					$this->obj->DB_update_all("company_cert","`status`='1'","`uid`='".$this->uid."' and `check2`='".$_POST['code']."'");
					$this->obj->member_log("手机绑定",13,1);
					$this->obj->DB_update_all("user_log","`status`='11'","`id`='".$_POST['logid']."'");
					$pay=$this->obj->DB_select_once("company_pay","`pay_remark`='手机绑定' and `com_id`='".$this->uid."'");
					if(empty($pay)){
						$this->MODEL('integral')->get_integral_action($this->uid,"integral_mobliecert","手机绑定");
					}
					echo 1;die;
				}
			}else{
				echo 2;die;
			}
		}
		if($_GET['type']){
			if($_GET['type']=="moblie")
			{
				$this->obj->DB_update_all("company","`moblie_status`='0'","`uid`='".$this->uid."'");
			}
			if($_GET['type']=="email")
			{
				$this->obj->DB_update_all("company","`email_status`='0'","`uid`='".$this->uid."'");
			}
			if($_GET['type']=="wxid")
			{
				$this->obj->DB_update_all("member","`wxid`='',`wxopenid`='',`unionid`=''","`uid`='".$this->uid."'");
			}
			if($_GET['type']=="qqid")
			{
				$this->obj->DB_update_all("member","`qqid`='',`qqunionid`=''","`uid`='".$this->uid."'");
			}
			if($_GET['type']=="sinaid")
			{
				$this->obj->DB_update_all("member","`sinaid`=''","`uid`='".$this->uid."'");
			}
			$this->waplayer_msg('解除绑定成功！');
		}
		$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."'");
		$this->yunset("member",$member);
		$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		$this->yunset("company",$company);
		 
		if($company['yyzz_status']!=1){
			$cert=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."' and `type`='3'","`id`,`status`,`statusbody`");
			$this->yunset("cert",$cert);
		}

		$this->rightinfo();
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"社交账号绑定");
		$this->get_user();
		$this->waptpl('binding');
	}
	function bindingbox_action(){
		$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."'");
		$this->yunset("member",$member);
		$this->rightinfo();
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"账户绑定");
		$this->get_user();
		$this->waptpl('bindingbox');
	}
	function setname_action(){
		if($_POST['username']){
			$user=$this->obj->DB_select_once("member","`uid`='".$this->uid."'");
			if($user['restname']=="1"){
				echo "您无权修改账户！";die;
			}
			$username=$_POST['username'];
			$num = $this->obj->DB_select_num("member","`username`='".$username."'");
			if($num>0){
				echo "用户名已存在！";die;
			}
			if($this->config['sy_regname']!=""){
				$regname=@explode(",",$this->config['sy_regname']);
				if(in_array($username,$regname)){
					echo "该用户名禁止使用！";die;
				}
			}
			
			$oldpass = md5(md5($_POST['password']).$user['salt']);
			if($user['password']!=$oldpass){
				echo "密码错误！";die;
			}
			$data['username']=$username;
			$data['restname']=1;
			$this->obj->update_once('member',$data,array('uid'=>$this->uid));
			
			$this->cookie->unset_cookie();
			
			$this->obj->member_log("修改账户",11);
			echo 1;die;
		}
		$user=$this->obj->DB_select_once("member","`uid`='".$this->uid."'");
		
		if($user['restname']=="1"){
			$data['msg']="您无权修改账户！";
			$data['url']='index.php?c=set';
			$this->yunset("layer",$data);
		}
		$this->rightinfo();
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"修改用户名");
		$this->get_user();
		$this->waptpl('setname');
	}

	function reward_list_action(){
		$urlarr['c']='reward_list';
		$urlarr["page"]="{{page}}";	
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("change","`uid`='".$this->uid."' order by id desc",$pageurl,"10");		
		if(is_array($rows)){
			foreach($rows as $key=>$val){
				$gid[]=$val['gid'];
			}
			$M=$this->MODEL('redeem');
			$gift=$M->GetReward(array('`id` in('.pylode(',', $gid).')'),array('field'=>'id,pic'));
			foreach($rows as $k=>$val){
				foreach ($gift as $v){
					if($val['gid']==$v['id']){
						$rows[$k]['pic']=$v['pic'];
					}
				}
			}
		}
		
		$dh = $sh = $wtg =0;
		if(is_array($rows)){
			foreach($rows as $value){
				if($value['status']=='0'){
					$sh +=1;
				}
				if($value['status']=='2'){
					$wtg +=1;
				}
				if($value['status']=='1'){
					$dh +=1;
				}												
			}
		}		
		$this->yunset(array('dh'=>$dh,'sh'=>$sh,'wtg'=>$wtg));
		
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'","rating_name,integral");
		$statis[integral]=number_format($statis[integral]);
		$this->yunset("statis",$statis);
		$this->yunset('rows',$rows);
		$backurl=Url('wap',array('c'=>'integral'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"兑换记录");
		$this->get_user();
		$this->waptpl('reward_list');
	}

	function delreward_action(){
		if($this->usertype!='2' || $this->uid==''){
			$this->waplayer_msg('登录超时！');
		}else{
			$rows=$this->obj->DB_select_once("change","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."' ");
			if($rows['id']){
				$this->obj->DB_update_all("reward","`num`=`num`-".$rows['num'].",`stock`=`stock`+".$rows['num']."","`id`='".$rows['gid']."'");
				$this->MODEL('integral')->company_invtal($this->uid,$rows['integral'],true,"取消兑换",true,2,'integral',24);
				$this->obj->DB_delete_all("change","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."' ");
			}
			$this->obj->member_log("取消兑换",17,3);
			$this->waplayer_msg('取消成功！');
		}
	}
	function paylog_action(){
		include(CONFIG_PATH."db.data.php");
		$this->yunset("arr_data",$arr_data);
		$urlarr=array("c"=>"paylog","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$where="`uid`='".$this->uid."' order by order_time desc";
		$this->get_page("company_job_order",$where,$pageurl,"10");

		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");

		$this->yunset('statis',$statis);
		$this->yunset('header_title',"财务明细");
		$this->get_user();
		$this->waptpl('paylog');
	}
	function paylogajax_action(){
	    $page = $_POST['page'];
	    $pagesize=5;
	    $offset = ($page-1)*$pagesize;
		$where="`uid`='".$this->uid."' order by order_time desc limit ". $offset. ", ".$pagesize;
		$rows = $this->obj->DB_select_all("company_job_order",$where);
		foreach ($rows as $key => $value) {
			$rows[$key]['order_time'] = date('Y-m-d H:m',$value['order_time']);
		}
		 echo json_encode($rows);die;
		
	}

	function delpaylog_action(){
		if($this->usertype!='2' || $this->uid==''){
			$this->waplayer_msg('登录超时！');
		}else{
			$oid=$this->obj->DB_select_once("company_order","`uid`='".$this->uid."' and `id`='".(int)$_GET['id']."' and `order_state`='1'","`id`,`order_id`");
			if(empty($oid)){
				$this->waplayer_msg('订单不存在！');
			}else{
				$this->obj->DB_update_all("user_log","`status`=4","`orderid`='".$oid['order_id']."' and `uid`='".$this->uid."'");
				$this->obj->DB_delete_all("company_order","`id`='".$oid['id']."' and `uid`='".$this->uid."'");
				$this->waplayer_msg('取消成功！');
			}
		}
	}

	function consume_action(){
		include(CONFIG_PATH."db.data.php");
		$this->yunset("arr_data",$arr_data);
		$urlarr=array("c"=>"consume","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$where="`com_id`='".$this->uid."'";
			
		$where.="  order by pay_time desc";
		$rows = $this->get_page("company_pay_order",$where,$pageurl,"10");
	
		if(is_array($rows)){
			foreach($rows as $k=>$v){
				$rows[$k]['pay_time']=date("Y-m-d H:i:s",$v['pay_time']);
				$rows[$k]['order_price']=str_replace(".00","",$rows[$k]['order_price']);
			}
		}
		if ($_GET['type']==1){
			$this->yunset('backurl',Url('wap',array('c'=>'com'),'member'));
		}else{
			$backurl=Url('wap',array('c'=>'integral'),'member');			
		}
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");

		$this->yunset('statis',$statis);
		$this->yunset('backurl',$backurl);
		$this->yunset("rows",$rows);
		$this->yunset('header_title',"财务明细");
		$this->get_user();
		$this->waptpl('consume');
	}
	function consumeajax_action(){
		include(CONFIG_PATH."db.data.php");
		
	    $page = $_POST['page'];
	    $pagesize=5;
	    $offset = ($page-1)*$pagesize;

		$where="`com_id`='".$this->uid."'";
		$where.="  order by pay_time desc limit ". $offset. ", ". $pagesize;
		$rows = $this->obj->DB_select_all("company_pay_order",$where);
	
		if(is_array($rows)){
			foreach($rows as $k=>$v){
				$rows[$k]['pay_time']=date("Y-m-d H:i:s",$v['pay_time']);
				$rows[$k]['order_price']=str_replace(".00","",$rows[$k]['order_price']);
				$rows[$k]['pay_time'] = date('Y-m-d H:m',$v['pay_time']);
			}
		}
		
		echo json_encode($rows);die;
		
	}

	function down_action(){
		$where="`comid`='".$this->uid."'";
		$urlarr['c']='down';
		$urlarr["page"]="{{page}}";
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("down_resume","$where order by id desc",$pageurl,"10");
		if(is_array($rows)&&$rows){
			if(empty($resume)){
				foreach($rows as $v){
					$uid[]=$v['uid'];
					$eid[]=$v['eid'];
				}
				$resume=$this->obj->DB_select_alls("resume","resume_expect","a.uid=b.uid and a.`r_status`<>'2' and a.uid in (".@implode(",",$uid).") and b.id in (".@implode(",",$eid).")","a.`name`,a.`uid`,a.`exp`,a.`sex`,a.`edu`,b.`id`,b.`minsalary`,b.`maxsalary`,b.`job_classid`,b.`height_status`");
			}
			$userid_msg=$this->obj->DB_select_all("userid_msg","`fid`='".$this->uid."' and `uid` in (".pylode(",",$uid).")","uid");
			if(is_array($resume)){
				include(PLUS_PATH."user.cache.php");
				include(PLUS_PATH."job.cache.php");
				include(CONFIG_PATH."db.data.php");
				unset($arr_data['sex'][3]);
				$this->yunset("arr_data",$arr_data);
				foreach($rows as $key=>$val){
					foreach($resume as $va){
						if($val['eid']==$va['id']){
							$rows[$key]['name']=$va['name'];
							$rows[$key]['sex']=$arr_data['sex'][$va['sex']];
							$rows[$key]['exp']=$userclass_name[$va['exp']];
							$rows[$key]['edu']=$userclass_name[$va['edu']];
							$rows[$key]['minsalary']=$va['minsalary'];
							$rows[$key]['maxsalary']=$va['maxsalary'];
							$rows[$key]['height_status']=$va['height_status'];
							if($va['job_classid']!=""){
								$job_classid=@explode(",",$va['job_classid']);
								$rows[$key]['jobname']=$job_name[$job_classid[0]];
							}
						}
					}
					foreach($userid_msg as $va){
						if($val['uid']==$va['uid']){
							$rows[$key]['userid_msg']=1;
						}
					}
				}
			}
		}
		$this->yunset("rows",$rows);
		$backurl=Url('wap',array('c'=>'resumecolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"下载简历");
		$this->get_user();
		$this->waptpl('down');
	}

	function downdel_action(){
		if($_GET['id']){
			$nid=$this->obj->DB_delete_all("down_resume","`id`='".(int)$_GET['id']."' and `comid`='".$this->uid."'"," ");
			if($nid){
			    $this->obj->member_log("删除已下载简历记录（ID:".(int)$_GET['id']."）",3,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}


	function ajax_refresh_job_action()
	{
		if(!isset($_POST['jobid'])){
			exit;
		}

		$jobid = $_POST['jobid'];
		
		$statis = $this->company_satic();

		$msg = '';
		
		
		$companyM = $this->MODEL('company');

		$result = $companyM->comVipDayActionCheck('refreshjob',$this->uid);
		if($result['status']!=1){
		    echo json_encode($result);
		    exit;
		}
		 
 		$M=$this->MODEL('comtc');
 		
 		$return = $M->refresh_job($_POST);
 	
 		if($return['status']==1){
			
			$data['msg']=$return['msg']." !";
			$data['error']=1;
			echo json_encode($data);
			exit;
		}else if($return['status']==2){
			
			$data['msg']=$return['msg']." !";
			$data['error']=2;
			echo json_encode($data);
			exit;
		}else{
			
			if($return['url']){
				$data['url'] = $return['url'];
			}
			$data['msg']=$return['msg'];
			$data['error']=3;
			echo json_encode($data);
 			exit;
		}
		$data['msg'] = $msg;
		echo json_encode($data);
		exit;
	}
    
    function ajax_refresh_part_action(){
		if(!isset($_POST['partid'])){
			exit;
		}
		$partid = $_POST['partid'];
		$statis = $this->company_satic();
		
		$companyM = $this->MODEL('company');
		$result = $companyM->comVipDayActionCheck('refreshpart',$this->uid);
		if($result['status']!=1){
			echo json_encode($result);
			exit;
		}
		 
 		$M=$this->MODEL('comtc');
 		$return = $M->refresh_part($_POST);
 		
 		if($return['status']==1){
			
			$data['msg']=$return['msg']." !";
			$data['error']=1;
			echo json_encode($data);
			exit;
		}else if($return['status']==2){
			
			$data['msg']=$return['msg']." !";
			$data['error']=2;
			echo json_encode($data);
			exit;
		}else{
			
			if($return['url']){
				$data['url'] = $return['url'];
			}
			$data['msg']=$return['msg'];
			$data['error']=3;
			echo json_encode($data);
 			exit;
		}
		echo json_encode($data);
		exit;
	}
    function special_action(){
        $urlarr=array("c"=>"special","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
        
		$rows=$this->get_page("special_com","`uid`='".$this->uid."' ORDER BY `time` DESC",$pageurl,"10");
        if($rows&&is_array($rows)){
			$uid=array();
			foreach($rows as $val){
				$sid[]=$val['sid'];
			}
			$special=$this->obj->DB_select_all("special","`id` in(".pylode(',',$sid).")","id,title,intro");
			foreach($rows as $key=>$val){
				foreach($special as $v){
					if($val['sid']==$v['id']){
						$rows[$key]['title']=$v['title'];
						$rows[$key]['intro']=$v['intro'];
					}
				}
			}
		}
		$backurl=Url('wap',array('c'=>'jobcolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset("header_title","专题招聘");
		$this->yunset("rows",$rows);
        $this->waptpl('special');
    }
    function delspecial_action(){
        $IntegralM=$this->MODEL('integral');
		$id=$this->obj->DB_select_once("special_com","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."' and `status`=0","uid,integral");
		if($id&&$id['integral']>0){
			$IntegralM->company_invtal($id['uid'],$id['integral'],true,"取消专题招聘报名，退还".$this->config['integral_pricename'],true,2,'integral');
		}
		$delid=$this->obj->DB_delete_all("special_com","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'"," ");
		if($delid){
			$this->obj->member_log("删除专题报名",14,3);
			$this->layer_msg('删除成功！',9,0,$_SERVER['HTTP_REFERER']);
		}else{
			$this->layer_msg('删除失败！',8,0,$_SERVER['HTTP_REFERER']);
		}
	}
	function zhaopinhui_action(){
		$urlarr=array("c"=>"zhaopinhui","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("zhaopinhui_com","`uid`='".$this->uid."' ORDER BY `ctime` DESC",$pageurl,"10");
		
		if(is_array($rows)){
			foreach($rows as $key=>$v){
				$zphid[]=$v['zid'];
				$jobids[]=$v['jobid'];
			}
			$jobids=@implode(',', $jobids);
			$jobid=array_unique(@explode(',', $jobids));
			
			$zhaopinhui=$this->obj->DB_select_all("zhaopinhui","`id` in (".pylode(',',$zphid).")","`id`,`title`,`address`,`starttime`,`endtime`");
			$job=$this->obj->DB_select_all("company_job","`id` in (".pylode(',',$jobid).")","`id`,`name`");
			$space=$this->obj->DB_select_all("zhaopinhui_space");
			$spaces=array();
			foreach($space as $val){
				$spacename[$val['id']]=$val['name'];
			}
			$jobs=array();
			foreach($rows as $k=>$v){
				foreach($zhaopinhui as $val){
					if($v['zid']==$val['id']){
						$rows[$k]['title']=$val['title'];
						$rows[$k]['address']=$val['address'];
						$rows[$k]['starttime']=$val['starttime'];
						$rows[$k]['endtime']=$val['endtime'];
					}
				}
				$rows[$k]['sidname']=$spacename[$v['sid']];
				$rows[$k]['bidname']=$spacename[$v['bid']];
				$rows[$k]['cidname']=$spacename[$v['cid']];
				
				$jobs=@explode(',', $v['jobid']);
				$jobname=array();
				if($jobs){
					foreach($job as $val){
						foreach ($jobs as $vv){
							if($vv==$val['id']){
								$jobname[]=$val['name'];
							}
						}
						$rows[$k]['jobname']=@implode(',', $jobname);
					}
				}
			}
		}
		$backurl=Url('wap',array('c'=>'jobcolumn'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset("rows",$rows);
		$this->yunset("header_title","招聘会记录");
		$this->waptpl('zhaopinhui');
	}
	function delzph_action(){
		$row=$this->obj->DB_select_once("zhaopinhui_com","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'","`price`,`status`");
		$delid=$this->obj->DB_delete_all("zhaopinhui_com","`id`='".(int)$_GET['id']."' and `uid`='".$this->uid."'"," ");
		if($delid){
			if($row['status']==0 && $row['price']>0){
			    $IntegralM=$this->MODEL('integral');
				$IntegralM->company_invtal($this->uid,$row['price'],true,"退出招聘会",true,2,'integral');
			}
			$this->obj->member_log("退出招聘会",14,3);
			$this->layer_msg('退出成功！',9,0,$_SERVER['HTTP_REFERER']);
		}else{
			$this->layer_msg('退出失败！',8,0,$_SERVER['HTTP_REFERER']);
		}
	}
	function set_action(){
		$company = $this->obj->DB_select_once("company","`uid`='".$this->uid."'");
		if($company['logo']&&$company['logo_status']!='0'){
			$company['logo']=null;
		}
		$this->yunset("company",$company);
		
		$cert=$this->obj->DB_select_once("company_cert","`uid`='".$this->uid."' and type='3'");
		$this->yunset("cert",$cert);
		
		$info = $this->obj->DB_select_once("member","`uid`='".$this->uid."'","`restname`");
		if($info['restname']=="0"){
			$this->yunset("setname",1);
		}
		
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"账户设置");
		$this->waptpl('set');
	}
	
	function sysnews_action(){	
		
		$userid_job=$this->obj->DB_select_once("userid_job","`com_id`='".$this->uid."' and `is_browse`='1' order by datetime desc","`job_name`,`uid`,`datetime`");
 		$resume=$this->obj->DB_select_once("resume","`uid`='".$userid_job['uid']."'","`name`");
 		$userid_job['name'] = $resume['name'];
 		$this->yunset('userid',$userid_job);
 		$userid_jobnum=$this->obj->DB_select_num("userid_job","`com_id`='".$this->uid."'and `is_browse`='1'");
 		$this->yunset('userid_jobnum',$userid_jobnum);
		
		$sxrows=$this->obj->DB_select_once("sysmsg","`fa_uid`='".$this->uid."' order by ctime desc");
		$this->yunset("sxrows",$sxrows);
		$sxnum=$this->obj->DB_select_num("sysmsg","`fa_uid`='".$this->uid."'and `remind_status`='0'");
		$this->yunset('sxnum',$sxnum);
 		
 		
	    $jobrows=$this->obj->DB_select_once("msg","`job_uid`='".$this->uid."' and `del_status`<>'1' order by datetime desc");
		$this->yunset('jobrows',$jobrows);
		
		$jobnum=$this->obj->DB_select_num("msg","`job_uid`='".$this->uid."'and `reply`=''");
		$this->yunset('jobnum',$jobnum);
		
        $this->yunset('header_title',"系统消息");
		
    	$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->waptpl('sysnews');
		
		
		
	}
	
	function msg_action(){
		$urlarr=array("c"=>"msg","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$rows=$this->get_page("msg","`job_uid`='".$this->uid."' and `del_status`<>'1' order by datetime desc",$pageurl,"15");
		if(is_array($rows)&&$rows){
			foreach($rows as $key=>$val){
				$rows[$key]['content']=strip_tags(trim($val['content']));
				$uid[]=$val['uid'];
			}
			$resume=$this->obj->DB_select_all("resume_expect","`uid` in (".@implode(",",$uid).")","`id`,`uid`");
		    if(is_array($resume)){
		    	foreach($rows as $k=>$v){		    		
		    		foreach($resume as $val){	    			
		    			if($v['uid']==$val['uid']){		    				
		    				$rows[$k]['did']=$val['id'];			    					    				
		    			}
		    		}
		    	}
		    }		
		}		
		$this->obj->DB_update_all("msg","`com_remind_status`='1'","`job_uid`='".$this->uid."' and `com_remind_status`='0'");
		        
        if($_POST['submit']){
			if($_POST['reply']==""){
				$this->waptpl('msg');
			}else{
				$data['reply']=$_POST['reply'];
				$data['reply_time']=time();
				$data['user_remind_status']='0';
				$where['id']=(int)$_POST['id'];
				$where['job_uid']=$this->uid;
				$nid=$this->obj->update_once("msg",$data,$where);	 			
	 			if($nid){
	 				$this->obj->member_log("回复企业评论",18,1);
	 				$data['msg']='回复成功';
	 				$data['url']='index.php?c=msg';
	 			}else{
	 				$data['msg']='添加失败';
	 			}
 				$this->yunset("layer",$data);
 				$this->waptpl('msg');
			}
		} 
		$this->yunset("rows",$rows);
        $backurl=Url('wap',array('c'=>'sysnews'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"求职咨询");
        $this->waptpl('msg');
	}
	
	function delmsg_action(){
	    if($_GET['id']){
			$nid=$this->obj->DB_delete_all("msg","`id`='".$_GET['id']."' and `job_uid`='".$this->uid."'");
 			if($nid){
 				$this->obj->member_log("删除求职咨询",18,3);
 				$this->layer_msg('删除成功!');
 			}else{
 				$this->layer_msg('删除失败！');
 			}
		}
	}
    
    function sxnews_action(){
    	$urlarr=array("c"=>"sxnews","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		$rows = $this->get_page("sysmsg","`fa_uid`='".$this->uid."' order by id desc",$pageurl,"15");
		if(is_array($rows)){
			$patten = array("\r\n", "\n", "\r");
			foreach($rows as $key=>$value){
			
				$rows[$key]['content_all'] = str_replace($patten, "<br/>", $value['content']);
			}
		}
		$this->yunset("rows",$rows);
		$backurl=Url('wap',array('c'=>'sysnews'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"系统消息");
		$this->waptpl('sxnews');
    }
    
    function sxnewsset_action(){
    	$id=(int)$_POST['id'];
		$remind_status=(int)$_POST['remind_status'];
		if($id&&$remind_status){
			$nid=$this->obj->update_once("sysmsg",array('remind_status'=>$remind_status),array("fa_id"=>$this->uid,"id"=>$id));
			$this->obj->member_log("更改系统消息状态（ID:".$id."）",18,2);
		}
		$nid?$this->waplayer_msg("操作成功！"):$this->waplayer_msg("操作失败！");
    }
    
    function delsxnews_action(){
		if ($_GET['id']){
            $nid=$this->obj->DB_delete_all("sysmsg","`id`='".$_GET['id']."' and `fa_uid`='".$this->uid."'");
 			if($nid){
 				$this->obj->member_log("删除系统消息",18,3);
 				$this->layer_msg('删除成功！');
 			}else{
 				$this->layer_msg('删除失败！');
 			}
		}
	}
	
	function attention_me_action(){
	    
	    
		$whereAtn = "`sc_uid` = '".$this->uid ."'";
		$users = $this->obj->DB_select_all("atn",$whereAtn);
		
				
		if(is_array($users)){
			foreach($users as $v){
				$uids[] = $v['uid'];
			}
		}
		
		
		$whereResume = "`uid` in (".pylode(',',$uids) .") ";
		
		$defineJobs = $this->obj->DB_select_all("resume",$whereResume," `uid`,`name`,`def_job`,`birthday`");
		
		
		if(is_array($defineJobs)){
			foreach($defineJobs as $v){
				$defineJobsId[] = $v['def_job'];
			}
		}
 		 
		$urlarr=array("c"=>"attention_me","page"=>"{{page}}");
		$pageurl=Url('wap',$urlarr,'member');
		
		
		$whereResumeExpect = " `id` in (".pylode(',',$defineJobsId) .") ";
		
 		$resume = $this->get_page("resume_expect",$whereResumeExpect,$pageurl,"5","`id`,`job_classid`,`exp`,`edu`,`minsalary`,`maxsalary`,`uid`");
 		
		
		if(is_array($resume)){
			foreach($resume as $k => $v){
				foreach($users as $u){
					if($v['uid'] == $u["uid"]){
						$resume[$k]['time'] = $u["time"];
						break;
					}
				}
				foreach($defineJobs as $d){
					if($v['uid'] == $d['uid']){
						$resume[$k]['username'] = $d['name'];
						$resume[$k]['birthday'] = $d['birthday'];
						break;
					}
				}
			}
		}
		
		
		$userid_msg=$this->obj->DB_select_all("userid_msg","`fid`='".$this->uid."' and `uid` in (".pylode(",",$uids).")","uid");
		
		if(is_array($resume) && !empty($resume)){
			include(PLUS_PATH."user.cache.php");
			include(PLUS_PATH."job.cache.php");
			foreach($resume as $key=>$val){
				
				$resume[$key]['exp']=$userclass_name[$val['exp']];
				$resume[$key]['edu']=$userclass_name[$val['edu']];
				$resume[$key]['minsalary']=$val['minsalary'];
				$resume[$key]['maxsalary']=$val['maxsalary'];
				if($val['job_classid']!="")
				{
					$job_classid=@explode(",",$val['job_classid']);
					$resume[$key]['jobname']=$job_name[$job_classid[0]];
				}
				
				foreach($userid_msg as $va)
				{
					if($val['uid']==$va['uid'])
					{
						$resume[$key]['userid_msg']=1;
					}
				}
			}
		}
		
		$JobM=$this->MODEL("job");
		$company_job=$JobM->GetComjobList(array("uid"=>$this->uid,"state"=>1," `r_status`<>'2' and `status`<>'1'"),array("field"=>"`name`,`id`"));
		$this->yunset("company_job",$company_job);
		
		$this->yunset('rows',$resume);
		
		$age=date("Y",time());
		$time=date("Y",0);
		
		$this->yunset("age",$age);
		$this->yunset("time",$time);
	    $backurl=Url('wap',array('c'=>'resumecolumn'),'member');
	    $this->yunset('backurl',$backurl);
		$this->yunset('header_title',"关注我的人才");

	    $this->waptpl('attention_me');
	}
	
	function atnmedel_action(){
		if($_GET['id']){
			$resume = $this->obj->DB_select_once("resume_expect","`id`='".$_GET['id']."'","`uid`");
 			
			$nid=$this->obj->DB_delete_all("atn","`uid`='".$resume['uid']."' and `sc_uid`='".$this->uid."'");
			
			if($nid){
			    $this->obj->member_log("删除关注我的人才（UID:".$resume['uid']."）",5,3);
				$this->waplayer_msg('删除成功！');
			}else{
				$this->waplayer_msg('删除失败！');
			}
		}
	}
        
	function searchcom_action(){
		$company=$this->obj->DB_select_all("company","`name` like '%".$this->stringfilter(trim($_POST['name']))."%' ","`uid`,`name`");
		
		if($company&&is_array($company)){
			$html="";
			foreach($company as $val){
				$html.="<div class='mui-input-row mui-radio mui-left'>
						<label>".$val['name']."</label>
						<input name='cuid' type='radio' value='".$val['uid']."'>
					</div>";
				
			}
		}else{
			$html=1;
		}
		echo $html;die;
	}

	function finance_action(){	    
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'");
		$this->yunset("statis",$statis);
		$this->yunset('header_title',"财务管理");
		$this->waptpl('finance');
	}
	function integral_action(){
		$baseInfo			= false;	
		$logo				= false;	
		$signin			    = false;	
		$emailChecked		= false;	
		$phoneChecked		= false;	
		$pay_remark         =false;
		$question        	=false;		
		$answer       		=false;		
		$answerpl           =false;		
		
		$map				= false;	
		$banner				= false;	
		$yyzz				= false;	
		
		$row = $this->obj->DB_select_once("company",'`uid` = '.$this->uid,
			"`name`,`hy`,
			`logo`,`email_status`,`moblie_status`,
			`x`,`y`,
			`firmpic`,
			`yyzz_status`");
		$ban= $this->obj->DB_select_once("banner","`uid`='".$this->uid."'","`pic`");
		$row['firmpic']=$ban['pic'];
		if(is_array($row) && !empty($row)){
			if($row['name'] != '' && $row['hy'] != '' )
				$baseInfo = true;
			
			if($row['logo'] != '') $logo = true;
			if($row['email_status'] != 0) $emailChecked = true;
			if($row['moblie_status'] != 0) $phoneChecked = true;
			if($row['x'] != 0 && $row['y'] != 0) $map = true;
			if($row['firmpic'] != '') $banner = true;
			if($row['yyzz_status'] != 0) $yyzz = true;
			
		}
		$date=date("Ymd");
		$reg=$this->obj->DB_select_once("member_reg","`uid`='".$this->uid."' and `usertype`='".$this->usertype."' and `date`='".$date."'");
		if($reg['id']){
		    $signin = true;
		}
		if($this->config['integral_question_type']=="1"){
			$question=$this->max_time('发布问题');
		}
		if($this->config['integral_answer_type']=="1"){
			$answer=$this->max_time('回答问题');
		}
		if($this->config['integral_answerpl_type']=="1"){
			$answerpl=$this->max_time('评论问答'); 
		}
		$statusList = array(
			'baseInfo'		=>$baseInfo,
			'logo'			=>$logo,
		    'signin'		=>$signin,
			'emailChecked'	=>$emailChecked,
			'phoneChecked'	=>$phoneChecked,
			'question'	    =>$question,
			'answer'	    =>$answer,
			'answerpl'	    =>$answerpl,
			'map'			=> $map,	
			'banner'		=> $banner,	
			'yyzz'			=> $yyzz	
		);
		$this->yunset("statusList",$statusList);
		$statis=$this->obj->DB_select_once("company_statis","`uid`='".$this->uid."'","`integral`");
		$this->yunset("statis",$statis);
		if($_GET['type']){
			$backurl=Url('wap',array('c'=>'finance'),'member');
		}else{
			$backurl=Url('wap',array(),'member');
		}
		
		$reg_url = Url('wap',array('c'=>'register','uid'=>$this->uid));
		$this->yunset('reg_url', $reg_url);
		
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"积分管理");
		$this->waptpl('integral');
	}
	
	function resumecolumn_action(){
		
		
		$sqnum=$this->obj->DB_select_num("userid_job","`com_id`='".$this->uid."'");
		$this->yunset('sqnum',$sqnum);
		
		$userid_jobnum=$this->obj->DB_select_num("userid_job","`com_id`='".$this->uid."'and `is_browse`='1'");
 		$this->yunset('userid_jobnum',$userid_jobnum);
 		
		
		
		$userid_msgnum=$this->obj->DB_select_num("userid_msg","`fid`='".$this->uid."'");
 		$this->yunset("invitenum",$userid_msgnum);
		
		
	    $looknum=$this->obj->DB_select_num("look_resume","`com_id`='".$this->uid."'and `com_status`='0'");
	    $this->yunset("looknum",$looknum);
	    
	    
	    $talentnum=$this->obj->DB_select_num("talent_pool","`cuid`='".$this->uid."'");
	    $this->yunset("talentnum",$talentnum);
	    
	    
	    $downnum=$this->obj->DB_select_num("down_resume","`comid`='".$this->uid."'");
	    $this->yunset("downnum",$downnum);
	    
	    
	    $atnnum=$this->obj->DB_select_num("atn","`sc_uid`='".$this->uid."'");
 	    $this->yunset("atnnum",$atnnum);
	    
	    
	    $lookjobnum=$this->obj->DB_select_num("look_job","`com_id`='".$this->uid."' and `com_status`='0'");
	    $this->yunset("lookjobnum",$lookjobnum);
	    
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"简历管理");

		$this->waptpl('resumecolumn');
	}
	
    function jobcolumn_action(){
		$member=$this->obj->DB_select_once("member","`uid`='".$this->uid."'");
		$this->yunset("member",$member);
		$this->rightinfo();
		$backurl=Url('wap',array(),'member');
		$this->yunset('backurl',$backurl);
 		$this->yunset("header_title","职位管理");
		$this->get_user();
		$this->company_satic();
		$this->waptpl('jobcolumn');
	}
	
	function integral_reduce_action(){
		$backurl=Url('wap',array('c'=>'integral'),'member');
		$this->yunset('backurl',$backurl);
		$this->get_user();
		$this->yunset('header_title',"消费规则");
		$this->waptpl('integral_reduce');
	}
	
	function banner_action(){
		
		if($_POST['submit']){
			if($_POST['preview']){
				
				$UploadM =$this->MODEL('upload');
				$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/company/",false);
				
				$pic     =$upload->imageBase($_POST['preview']);
				
				$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);
				if($picmsg['status']==$pic){
					$data['msg']=$picmsg['msg'];
 				}else{
					
					$photo=str_replace(APP_PATH."/data/upload/company/","./data/upload/company/",$pic);
					$datap['uid']=$this->uid;
					$datap['pic']=$photo;
				}

			}
			
			if($data['msg']==""){
				$row=$this->obj->DB_select_once("banner","`uid`='".$this->uid."'");
				
				if($row['id']){
					if($row['pic']){
						unlink_pic(APP_PATH.$row['pic']);
					}
					$nid=$this->obj->update_once("banner",$datap,array('id'=>$row['id']));
				}else{
					$nid=$this->obj->insert_into("banner",$datap);
				}
				
				if($nid){
					$this->obj->member_log("上传企业横幅",16,1);
							
					if(!$row['id']){
						$IntegralM=$this->MODEL('integral');
						$IntegralM->get_integral_action($this->uid,"integral_banner","上传企业横幅");
					}
							
					$data['msg']="设置成功！";
					$data['url']='index.php?c=integral';
				}else{
					$data['msg']="设置失败！";
					$data['url']='index.php?c=banner';
				}
				
			}else{
				
				$data['msg']=$data['msg'];
				$data['url']='index.php?c=banner';
				
			}
			
		}
		
		$banner=$this->obj->DB_select_once("banner","`uid`='".$this->uid."'");
		
		if($banner['pic'] && file_exists(str_replace('./',APP_PATH,$banner['pic']))){
			$banner['pic']=str_replace('./',$this->config['sy_weburl'].'/',$banner['pic']);
		}else{
			$banner['pic']='';
		}
		
		$this->yunset("banner",$banner);
		$this->yunset("layer",$data);
		$backurl=Url('wap',array('c'=>'integral'),'member');
		$this->yunset("backurl",$backurl);
		$this->yunset('header_title',"企业横幅");
		$this->waptpl('banner');
	}
	function show_action(){

         //die('show_action');

		$urlarr['c']="show";
		$urlarr["page"]="{{page}}";
		$pageurl=Url('wap',$urlarr,'member');
		$rows = $this->get_page("company_show","`uid`='".$this->uid."' order by sort desc",$pageurl,"12","`title`,`id`,`picurl`");
		
		if($rows&&is_array($rows)){
			foreach($rows as $k=>$v){
				$rows[$k]['picurl']=str_replace('./','/',$v['picurl']);
			}
		}
		$this->yunset("rows",$rows);
		$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`name`");
		$this->yunset("company",$company);
		
		$this->yunset("js_def",2);
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"企业环境");
		$this->waptpl('show');
	}
	//whp 新增 公司地址设置 s 0404

	function companyaddress_action(){
		include PLUS_PATH."/user.cache.php";
		include PLUS_PATH."/city.cache.php";
		$addcompanyaddress=$this->obj->DB_select_once("addcompanyaddress","`uid`='".$this->uid."' and `type` = '1'");
		$city=$city_name[$addcompanyaddress['provinceid']].'-'.$city_name[$addcompanyaddress['cityid']];
		if($addcompanyaddress['three_cityid']){
			$city.='-'.$city_name[$addcompanyaddress['three_cityid']];
		}
		$this->yunset("address",$addcompanyaddress['address']);
		$this->yunset("city",$city);

		$addcompanyaddresslist=$this->obj->DB_select_all("addcompanyaddress","`uid`='".$this->uid."' and `type` = '0'");
		foreach ($addcompanyaddresslist as $key => $value) {
			$addcompanyaddresslist[$key]['city'] = $city_name[$value['provinceid']].'-'.$city_name[$value['cityid']].'-'.$city_name[$value['three_cityid']];
		}
		
		$this->yunset("addcompanyaddresslist",$addcompanyaddresslist);
		$backurl=Url('wap',array('c'=>'set'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"企业地址");
		$this->waptpl('companyaddress');
	}

	function addcompanyaddress_action(){
		include PLUS_PATH."/city.cache.php";
		if($_GET['id']){
			$addcompanyaddressone=$this->obj->DB_select_once("addcompanyaddress","`id`='".$_GET['id']."' and `type` = '0' and `uid`='".$this->uid."'");
			$header_title = '编辑企业地址';
		}else{
			$header_title = '添加企业地址';
		}
		$this->yunset('row',$addcompanyaddressone);
		$this->yunset('companyuid',$this->uid);
		$this->yunset('city_name',$city_name);
		$backurl=Url('wap',array('c'=>'companyaddress'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',$header_title);
		$this->waptpl('addcompanyaddress');
	}

	function infoaddcompanyaddress_action(){
		$this->rightinfo();
		if($_POST['submit']){
			$_POST=$this->post_trim($_POST);
			if($data['msg']==''){
				if($_POST['provinceid']==""){
					$data['msg']='所在地不能为空！';
				}else if($_POST['address']==""){
					$data['msg']='公司地址不能为空！';
				}
			}

			if($_POST['companyaddresid']){


					if($data['msg']==''){

						$sql['uid']=$this->uid;
						$sql['provinceid']=$_POST['provinceid'];
						$sql['cityid']=$_POST['cityid'];
						$sql['three_cityid']=$_POST['three_cityid'];
						$sql['address']=$_POST['address'];
						$nid=$this->obj->update_once("addcompanyaddress",$sql,array('id'=>$_POST['companyaddresid']));
						if($nid){
							$data['msg']='编辑成功！';
							$data['url']='index.php?c=companyaddress';
						}else{
							$data['msg']='编辑失败！';
							$data['url']='index.php?c=addcompanyaddress';
						}
						
					}	
					echo json_encode($data);die;

			}else{

					if($data['msg']==''){
						$sql['uid']=$this->uid;
						$sql['provinceid']=$_POST['provinceid'];
						$sql['cityid']=$_POST['cityid'];
						$sql['three_cityid']=$_POST['three_cityid'];
						$sql['address']=$_POST['address'];
						$nid=$this->obj->insert_into("addcompanyaddress",$sql);

						if($nid){
							$data['msg']='添加成功！';
							$data['url']='index.php?c=companyaddress';
						}else{
							$data['msg']='添加失败！';
							$data['url']='index.php?c=addcompanyaddress';
						}
						
					}	
					echo json_encode($data);die;

			}



		}

	}

	function addressdel_action(){
		if($_POST['id']==""){
			$data=3;
		}else{
			$row=$this->obj->DB_select_once("addcompanyaddress","`id`='".(int)$_POST['id']."' and `uid`='".$this->uid."'","`provinceid`");
			if(is_array($row)){
				unlink_pic(".".$row['provinceid']);
				$oid=$this->obj->DB_delete_all("addcompanyaddress","`id`='".(int)$_POST['id']."' and `uid`='".$this->uid."' and `type`='0'");
			}
			if($oid){
				$data=1;
			}else{
				$data=2;
			}
		}
		echo json_encode($data);die;
	}
	



	//whp 新增 公司地址设置 e 0404
	
	function del_action(){
		if($_POST['id']==""){
			$data=3;
		}else{
			$row=$this->obj->DB_select_once("company_show","`id`='".(int)$_POST['id']."' and `uid`='".$this->uid."'","`picurl`");
			if(is_array($row)){
				unlink_pic(".".$row['picurl']);
				$oid=$this->obj->DB_delete_all("company_show","`id`='".(int)$_POST['id']."' and `uid`='".$this->uid."'");
			}
			if($oid){
				$this->obj->member_log("删除企业环境展示",16,3);
				$data=1;
			}else{
				$data=2;
			}
		}
		echo json_encode($data);die;
	}
	
	function addshow_action(){
		if($_POST['submit']){
			
			if($_POST['preview']){
				print_r($_POST['preview']);die("a");
				$UploadM =$this->MODEL('upload');
				$upload  =$UploadM->Upload_pic(APP_PATH."/data/upload/show/",false);
				
				$pic     =$upload->imageBase($_POST['preview']);
				
				$picmsg  = $UploadM->picmsg($pic,$_SERVER['HTTP_REFERER']);
				if($picmsg['status']==$pic){
					$data['msg']=$picmsg['msg'];
 				}else{
 					$photo=str_replace(APP_PATH."/data/upload/show/","./data/upload/show/",$pic);
 					
 					$picurl=$photo;
				}
			}
			
			if($data['msg']==""){
				$datashow=array(
					'title'=>$_POST['title'],
					'uid'=>$this->uid,
					'ctime'=>time()
				);
				$companyM = $this->MODEL('company');
				if($_POST['id']){
					$row=$this->obj->DB_select_once("company_show","`id`='".$_GET['id']."' and `uid`='".$this->uid."'");
					if(!$picurl){
						$datashow['picurl']=$row['picurl'];
					}elseif($picurl!=$row['picurl']){
						if($row['picurl']){
							unlink_pic(APP_PATH.$row['picurl']);
						}
						$datashow['picurl']=$picurl;
					}
					$nid = $companyM->UpdateShow($datashow,array('id'=>intval($_POST['id']),'uid'=>$this->uid));
					if($nid){
						$data['msg']='更新成功！';
						$data['url']='index.php?c=show';
					}else{
						$data['msg']='更新失败！';
						$data['url']='index.php?c=show';
					}
				}else{
					if(!$picurl){
						$data['msg']='请上传企业环境！';
					}else{
						$datashow['picurl']=$picurl;
						$id = $companyM->AddCompanyShow($datashow);
						if($id){
							$data['msg']='上传成功！';
							$data['url']='index.php?c=show';
						}else{
							$data['msg']='上传失败！';
							$data['url']='index.php?c=show';
						}
					}
				}
			}else{
				$data['msg']=$data['msg'];
				$data['url']='index.php?c=show';
			}
		}else{
			if($_GET['id']){
				$row=$this->obj->DB_select_once("company_show","`id`='".$_GET['id']."' and `uid`='".$this->uid."'");
				$row['picurl']=str_replace('./','/',$row['picurl']);
				$this->yunset("row",$row);
			}
		}
		$company=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`name`");
		$this->yunset("company",$company);
		
		$this->yunset("layer",$data);
		$backurl=Url('wap',array('c'=>'show'),'member');
		$this->yunset('backurl',$backurl);
		$this->yunset('header_title',"企业环境");
		$this->get_user();
		$this->waptpl('addshow');
	}
	function userLog_action(){
		if($_POST){	
			$_POST['uid'] = $this->uid;
			$_POST['usertype'] = $this->usertype;
			$LogM = $this->MODEL('log');
			 
			if($_COOKIE["delay"]==""){
				$nid = $LogM->addUserLog($_POST);
				$this->cookie->SetCookie("delay",$nid,time() + 60);
				echo $nid;die;
			}else{
				$ul = $this->obj->DB_select_once("user_log","`id`='".$_COOKIE["delay"]."'","`second`,`opera`");
				
				if($ul['opera']==$_POST['opera']){
					
					$data['id'] = $_COOKIE["delay"];
					$data['orderid'] = $_POST["orderid"];
					$data['second'] = $_POST['second']+$ul['second'];
					$LogM->updateUserLog($data);
					echo $_COOKIE["delay"];die;

				}else{

					$nid = $LogM->addUserLog($_POST);
					$this->cookie->SetCookie("delay",$nid,time() + 60);
					echo $nid;die;

				}
			}
 		}
	} 

	function gxUserLog_action(){
		if($_POST){
			if($_COOKIE["delay"]!=""){
				$ul = $this->obj->DB_select_once("user_log","`id`='".$_COOKIE["delay"]."'","`second`");
				$_POST['second']=$_POST['second']+$ul['second'];
			}
			$LogM = $this->MODEL('log');
			$_POST['uid'] = $this->uid;
			$_POST['usertype'] = $this->usertype;
			$LogM->updateUserLog($_POST);
		}
	}
}
	
?>